diff options
| author | qsm-odoo <qsm@odoo.com> | 2019-04-08 05:33:21 +0000 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2019-04-19 11:17:56 +0000 |
| commit | a742bf3d5bd3d613cc792339b910ac0f5143e2d7 (patch) | |
| tree | fa237fe6b64c2dba240386e8831fd6b4de4c3685 | |
| parent | bf1e39540f53c3180eca56a5adc7b30d3334309b (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>
| -rw-r--r-- | addons/website_sale/static/src/js/website_sale.js | 9 |
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 () {}); }, /** |
