[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>
This commit is contained in:
Victor Feyens
2020-02-03 12:43:03 +00:00
parent df0c60ccc7
commit 7ae9b81186
@@ -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();
}
});
},
/**