From e0fbe7b5becf608f76f02123f3076cf27c54c20e Mon Sep 17 00:00:00 2001 From: rde Date: Mon, 16 Oct 2017 14:19:19 +0200 Subject: [PATCH] [FIX] website_sale: disable checkout btn if GTS unchecked at load opw-774286 *Before this commit: On checkout, you can enable a step to force user to have the General Terms of Sale checked to continue the checkout. Checking/Unchecking will correctly disabled/enabled the button. The checkbox is already checked at page load (on the template). BUT, if the template has been modified to set the checkbox as unchecked at load (eg the user removed 'checked="checked"' from the template), the button will still be enabled even if the checkbox is unchecked. *Now: No matter if it is checked or not on the template, the button will correctly be enabled/disabled regarding the checkbox state at load. --- addons/website_sale/static/src/js/website_sale_payment.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 5b02f5b7c61..266c69a9db5 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() { + $("#checkbox_cgv").change(function() { $("div.oe_sale_acquirer_button").find('input, button').prop("disabled", !this.checked); }); + $('#checkbox_cgv').trigger('change'); } // When choosing an acquirer, display its Pay Now button