From 77566f5067ee56bab1ad7e697b7abe1b7745dcc4 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Wed, 13 Sep 2017 16:44:18 +0200 Subject: [PATCH] [FIX] website_sale: Pay Now button is clickable even without clicking policies and conditions Steps to reproduce the bug: -Go to the shop -Add an item to card -Checkout -Insert address info -Click proceed -Enable "Accept Terms & Conditions" -With the HTML Editor, remove the attribute checked="checked" in template Accept Terms & Conditions Bug: -Pay Now button is clickable but the Policy and Procedures box was not checked. opw:771418 --- addons/website_sale/static/src/js/website_sale_payment.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/website_sale/static/src/js/website_sale_payment.js b/addons/website_sale/static/src/js/website_sale_payment.js index c4c4861654d..526145bba8d 100644 --- a/addons/website_sale/static/src/js/website_sale_payment.js +++ b/addons/website_sale/static/src/js/website_sale_payment.js @@ -6,9 +6,10 @@ var ajax = require('web.ajax'); $(document).ready(function () { // If option is enable if ($("#checkbox_cgv").length) { - $("#checkbox_cgv").click(function() { + var enabling_button = function() { $("div.oe_sale_acquirer_button").find('input, button').prop("disabled", !this.checked); - }); + }; + $("#checkbox_cgv").click(enabling_button).each(enabling_button); } // When choosing an acquirer, display its Pay Now button