diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-06-19 14:41:36 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-06-19 14:41:36 +0200 |
| commit | 37e05d35d2e75960cd2f8a0c6350ec611f955518 (patch) | |
| tree | d7631f090ad046b35fc8cfd412d39bb900c34f31 /addons | |
| parent | 92a1f215c0518a1e33d08f003a6098a0401ccd3b (diff) | |
| parent | 132e38beeffc97c30d79eae1f18836e8117fc45e (diff) | |
[MERGE] forward port branch saas-11.3 up to 132e38beeff
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/product/report/product_pricelist.py | 3 | ||||
| -rw-r--r-- | addons/website_sale_comparison/static/src/js/website_sale_comparison.js | 11 |
2 files changed, 12 insertions, 2 deletions
diff --git a/addons/product/report/product_pricelist.py b/addons/product/report/product_pricelist.py index e6ccde44d8e..abdb705c529 100644 --- a/addons/product/report/product_pricelist.py +++ b/addons/product/report/product_pricelist.py @@ -28,7 +28,8 @@ class report_product_pricelist(models.AbstractModel): } def _get_quantity(self, data): - return sorted([data['form'][key] for key in data['form'] if key.startswith('qty') and data['form'][key]]) + form = data and data.get('form') or {} + return sorted([form[key] for key in form if key.startswith('qty') and form[key]]) def _get_categories(self, pricelist, products, quantities): categ_data = [] diff --git a/addons/website_sale_comparison/static/src/js/website_sale_comparison.js b/addons/website_sale_comparison/static/src/js/website_sale_comparison.js index a52d548cb77..45b2b60d8e6 100644 --- a/addons/website_sale_comparison/static/src/js/website_sale_comparison.js +++ b/addons/website_sale_comparison/static/src/js/website_sale_comparison.js @@ -1,6 +1,7 @@ odoo.define('website_sale_comparison.comparison', function (require) { 'use strict'; +var concurrency = require('web.concurrency'); var core = require('web.core'); var utils = require('web.utils'); var Widget = require('web.Widget'); @@ -31,6 +32,7 @@ var ProductComparison = Widget.extend(ProductConfiguratorMixin, { this.product_data = {}; this.comparelist_product_ids = JSON.parse(utils.get_cookie('comparelist_product_ids') || '[]'); this.product_compare_limit = 4; + this.guard = new concurrency.Mutex(); }, /** * @override @@ -157,6 +159,9 @@ var ProductComparison = Widget.extend(ProductConfiguratorMixin, { * @private */ _addNewProducts: function (product_id) { + this.guard.exec(this._addNewProductsImpl.bind(this, product_id)); + }, + _addNewProductsImpl: function (product_id) { var self = this; $('.o_product_feature_panel').addClass('d-md-block'); if (!_.contains(self.comparelist_product_ids, product_id)) { @@ -164,8 +169,9 @@ var ProductComparison = Widget.extend(ProductConfiguratorMixin, { if (_.has(self.product_data, product_id)){ self._updateContent(); } else { - self._loadProducts([product_id]).then(function () { + return self._loadProducts([product_id]).then(function () { self._updateContent(); + self._updateCookie(); }); } } @@ -192,6 +198,9 @@ var ProductComparison = Widget.extend(ProductConfiguratorMixin, { * @private */ _removeFromComparelist: function (e) { + this.guard.exec(this._removeFromComparelistImpl.bind(this, e)); + }, + _removeFromComparelistImpl: function (e) { this.comparelist_product_ids = _.without(this.comparelist_product_ids, $(e.currentTarget).data('product_product_id')); $(e.currentTarget).parents('.o_product_row').remove(); this._updateCookie(); |
