Skip to content
Snippets Groups Projects
Commit d360b457 authored by Andrew Chau's avatar Andrew Chau Committed by William Braeckman
Browse files

[FIX] website_sale_comparison: Ensure product_data available


Check whether the product ID of the first item exists inside product_data
before trying to access it. Although it means the first item still does not
appear, both products will be present in the user's cookies.
When the user refreshes the page or navigates away, both products will be
visible in the comparison panel.

closes odoo/odoo#97152

X-original-commit: 5c6a92d0
Signed-off-by: default avatarWilliam Braeckman (wbr) <wbr@odoo.com>
parent a15ecc8a
Branches
Tags
No related merge requests found
......@@ -195,8 +195,12 @@ var ProductComparison = publicWidget.Widget.extend(VariantMixin, {
var self = this;
this.$('.o_comparelist_products .o_product_row').remove();
_.each(this.comparelist_product_ids, function (res) {
var $template = self.product_data[res].render;
self.$('.o_comparelist_products').append($template);
if (self.product_data.hasOwnProperty(res)) {
// It is possible that we do not have the required product_data for all IDs in
// comparelist_product_ids
var $template = self.product_data[res].render;
self.$('.o_comparelist_products').append($template);
}
});
if (force !== 'hide' && (this.comparelist_product_ids.length > 1 || force === 'show')) {
$('#comparelist .o_product_panel_header').popover('show');
......
Australia, 2022-01-15
I hereby agree to the terms of the Odoo Individual Contributor License
Agreement v1.0.
I declare that I am authorized and able to make this agreement and sign this
declaration.
Signed,
Andrew Chau ky@andrewchau.com https://github.com/AndrewChau
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment