[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.
This commit is contained in:
rde
2017-10-17 17:40:41 +02:00
parent 6e46ba7b46
commit e0fbe7b5be
@@ -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