[FIX] website_sale: traceback when adding payment terms

Go to the webshop checkout page.
Customise to add "Accept Terms & Conditions".
You get a traceback.

The 'change #checkbox_cgv' event was triggered before the initialisation
of the WebsiteSalePayment widget.

opw 2126456
opw 2122942

Closes odoo/odoo#39814

closes odoo/odoo#40553

X-original-commit: 2741f3d9ab7833e3d777d87206537eca6894ef79
Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
This commit is contained in:
Nans Lefebvre
2019-11-20 11:11:46 +00:00
committed by fw-bot
parent 64b9269b9b
commit 9fca59f5b6
2 changed files with 1 additions and 3 deletions
@@ -211,8 +211,6 @@ publicWidget.registry.WebsiteSale = publicWidget.Widget.extend(VariantMixin, {
this.$('select[name="country_id"]').change();
this.$('#checkbox_cgv').trigger('change');
core.bus.on('resize', this, function () {
if (config.device.size_class === config.device.SIZES.XL) {
$('.toggle_summary_div').addClass('d-none d-xl-block');
@@ -15,7 +15,7 @@ publicWidget.registry.WebsiteSalePayment = publicWidget.Widget.extend({
start: function () {
this.$checkbox = this.$('#checkbox_cgv');
this.$payButton = $('button#o_payment_form_pay');
this._adaptPayButton();
this.$checkbox.trigger('change');
return this._super.apply(this, arguments);
},