summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2019-04-08 05:33:21 +0000
committerqsm-odoo <qsm@odoo.com>2019-04-19 11:17:56 +0000
commita742bf3d5bd3d613cc792339b910ac0f5143e2d7 (patch)
treefa237fe6b64c2dba240386e8831fd6b4de4c3685 /addons
parentbf1e39540f53c3180eca56a5adc7b30d3334309b (diff)
[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>
Diffstat (limited to 'addons')
-rw-r--r--addons/website_sale/static/src/js/website_sale.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/addons/website_sale/static/src/js/website_sale.js b/addons/website_sale/static/src/js/website_sale.js
index 317dc513d5c..efac0663add 100644
--- a/addons/website_sale/static/src/js/website_sale.js
+++ b/addons/website_sale/static/src/js/website_sale.js
@@ -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 () {});
},
/**