From 2da2f5d5dc43573ce004909c1a01006198ba586a Mon Sep 17 00:00:00 2001 From: Ivan Yelizariev Date: Thu, 22 Jul 2021 13:14:51 +0000 Subject: [PATCH] [FIX] product: speed up _get_possible_combinations Excluding non-active records decreases number of combinations generated in _cartesian_product. The excluded combinations have to be rejected anyway [1], so don't waste time on it. STEPS: * activate "Product Configurator" * create a product with many attributes * make some `product.template.attribute.value` inactive (ptav_active = False): ** create a sale order with that value (e.g. color "Black" in "Customizable Desk (CONFIG)") ** delete that value in `product.template` form (tab "Variants") * add the product to a sale order * RESULT: `_cartesian_product` doesn't generates combination with archived attribute [1] https://github.com/odoo/odoo/blob/f9d26509a714ecd290c42e1d58e416bb01268447/addons/product/models/product_template.py#L839-L841 --- opw-2540675 closes odoo/odoo#74310 X-original-commit: ce487c920c777735e5e7e46ee131cb18dfc5c9fc Signed-off-by: Ivan Yelizariev // IEL --- addons/product/models/product_template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/product/models/product_template.py b/addons/product/models/product_template.py index d1e14b0176e..5d624a4fd53 100644 --- a/addons/product/models/product_template.py +++ b/addons/product/models/product_template.py @@ -1134,7 +1134,7 @@ class ProductTemplate(models.Model): yield necessary_values product_template_attribute_values_per_line = [ - ptal.product_template_value_ids + ptal.product_template_value_ids._only_active() for ptal in attribute_lines ]