[FIX] website_sale_comparison: Tuple index out of range
Some product template with attributes never have variants because the attributes have the field 'create_variant' set to 'no_variant' So "Tuple index out of range" was raised due to these kind of products. opw:1911962 closes odoo/odoo#29428
This commit is contained in:
@@ -26,7 +26,8 @@ class WebsiteSaleProductComparison(WebsiteSale):
|
||||
continue
|
||||
res.setdefault(cat_name, {}).setdefault(att_name, [' - '] * len(products))
|
||||
val = product.attribute_value_ids.filtered(lambda x: x.attribute_id == var.attribute_id)
|
||||
res[cat_name][att_name][num] = val[0].name
|
||||
if val:
|
||||
res[cat_name][att_name][num] = val[0].name
|
||||
values['specs'] = res
|
||||
values['compute_currency'] = self._get_compute_currency_and_context()[0]
|
||||
return request.render("website_sale_comparison.product_compare", values)
|
||||
|
||||
Reference in New Issue
Block a user