From 1682deacc51500d7d398f735031bbcbff29e7e66 Mon Sep 17 00:00:00 2001 From: Victor Feyens Date: Tue, 4 Jul 2023 15:57:51 +0000 Subject: [PATCH] [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) --- addons/product/models/product_template.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/product/models/product_template.py b/addons/product/models/product_template.py index 6c587672d00..e9e26c63822 100644 --- a/addons/product/models/product_template.py +++ b/addons/product/models/product_template.py @@ -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,