[FIX] product: archived product without attributes

Steps to reproduce:
1. Create a product "My Test Product" (no attribute)
2. Create a quotation, select the "My Test Product" product and confirm the sale order
3. Go back to product and add an attribute "Size" with values "L", "XL"
4. Create another quotation, select the ""My Test Product" product => crash

We consider archived combination of attributes as forbidden combination in
the configurator, but when the archived product doesn't have any attribute,
the `archived_combination` was an empty list, which wasn't supported well
by the product configurator logic (client-side).

To quickly fix this issue, we can simply stop sending empty archived combination
(i.e. when the archived product had no attributes).

opw-3410383

closes odoo/odoo#127335

X-original-commit: ca1ac1a115fe06a0a2d2de0fb131a58019f73631
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
This commit is contained in:
Victor Feyens
2023-07-06 16:23:56 +02:00
parent 6eb921c06c
commit 1682deacc5
+5 -1
View File
@@ -791,7 +791,11 @@ class ProductTemplate(models.Model):
archived_products = self.with_context(active_test=False).product_variant_ids.filtered(lambda l: not l.active)
return {
'exclusions': self._complete_inverse_exclusions(self._get_own_attribute_exclusions()),
'archived_combinations': [product.product_template_attribute_value_ids.ids for product in archived_products],
'archived_combinations': [
product.product_template_attribute_value_ids.ids
for product in archived_products
if product.product_template_attribute_value_ids
],
'parent_exclusions': self._get_parent_attribute_exclusions(parent_combination),
'parent_combination': parent_combination.ids,
'parent_product_name': parent_name,