summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Feyens <vfe@odoo.com>2020-01-30 13:29:32 +0000
committerVictor Feyens <vfe@odoo.com>2020-02-03 12:43:03 +0000
commit7ae9b81186c063e323aee5a2d7ae6ce1b389ace5 (patch)
treed6a7906d33221f16aa741dc85e75335a72cee563
parentdf0c60ccc7cb86e00b7d4000de6aa59186968818 (diff)
[FIX] website_sale_comparison: archived (or deleted) products
Archived or deleted products shouldn't be counted in the comparison widget count anymore. The current behavior did only reset the cookie (and the count) when products were added/removed from the comparison, but didn't consider the case when the products currently in the cookie weren't all existing/valid. Fixes #44049 closes odoo/odoo#44485 X-original-commit: 0b488842c0be2160c5ccd3b5b03b02a728f4eec5 Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
-rw-r--r--addons/website_sale_comparison/static/src/js/website_sale_comparison.js7
1 files changed, 7 insertions, 0 deletions
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 b425f4cc852..fc56f1c3a35 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
@@ -145,6 +145,13 @@ var ProductComparison = publicWidget.Widget.extend(VariantMixin, {
_.each(data, function (product) {
self.product_data[product.product.id] = product;
});
+ if (product_ids.length > Object.keys(data).length) {
+ /* If some products have been archived
+ they are not displayed but the count & cookie
+ need to be updated.
+ */
+ self._updateCookie();
+ }
});
},
/**