[FIX] website_sale: fix double click on add to cart
Using "async" in the event parameter is not enough, you have to return correct promises in the event handlers. closes odoo/odoo#32479 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
@@ -458,7 +458,7 @@ publicWidget.registry.WebsiteSale = publicWidget.Widget.extend(VariantMixin, {
|
||||
false
|
||||
);
|
||||
|
||||
productReady.then(function (productId){
|
||||
return productReady.then(function (productId) {
|
||||
$form.find(productSelector.join(', ')).val(productId);
|
||||
|
||||
self.rootProduct = {
|
||||
@@ -471,12 +471,10 @@ publicWidget.registry.WebsiteSale = publicWidget.Widget.extend(VariantMixin, {
|
||||
|
||||
return self._onProductReady();
|
||||
});
|
||||
|
||||
return productReady;
|
||||
},
|
||||
|
||||
_onProductReady: function () {
|
||||
this._submitForm();
|
||||
return this._submitForm();
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -484,6 +482,7 @@ publicWidget.registry.WebsiteSale = publicWidget.Widget.extend(VariantMixin, {
|
||||
* in the form data and trigger submit.
|
||||
*
|
||||
* @private
|
||||
* @returns {Promise} never resolved
|
||||
*/
|
||||
_submitForm: function () {
|
||||
var $productCustomVariantValues = $('<input>', {
|
||||
@@ -501,6 +500,8 @@ publicWidget.registry.WebsiteSale = publicWidget.Widget.extend(VariantMixin, {
|
||||
this.$form.append($productNoVariantAttributeValues);
|
||||
|
||||
this.$form.trigger('submit', [true]);
|
||||
|
||||
return new Promise(function () {});
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user