From 17e12603a281353f9630dd5fc851324dbdddee55 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 13 Mar 2020 16:46:03 +0000 Subject: [PATCH] [FIX] mrp: dynamic attribute - In inventory app, create an attribute that is dynamic - Create a product with a variant with the dynamic attribute - Create a bom for the product with some specific component for that variant - Open structure and cost A crash occurs. In this case, the object is a `product.template`, so a condition product-specific shouldn't be checked. The template is set at: https://github.com/odoo/odoo/blob/3588487ab4ef867f7fb981a395deaf298eb4a4e4/addons/mrp/report/mrp_report_bom_structure.py#L107 opw-2198976 closes odoo/odoo#47769 X-original-commit: 3c476dee5d3a0cc0fde0f9c6620507a07929e4fc Signed-off-by: Nicolas Martinelli (nim) --- addons/mrp/models/mrp_bom.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/mrp/models/mrp_bom.py b/addons/mrp/models/mrp_bom.py index 6b781b8b30a..7c973e642d1 100644 --- a/addons/mrp/models/mrp_bom.py +++ b/addons/mrp/models/mrp_bom.py @@ -355,6 +355,8 @@ class MrpBomLine(models.Model): them has to be found on the variant. """ self.ensure_one() + if product._name == 'product.template': + return False if self.bom_product_template_attribute_value_ids: for ptal, iter_ptav in groupby(self.bom_product_template_attribute_value_ids.sorted('attribute_line_id'), lambda ptav: ptav.attribute_line_id): if not any([ptav in product.product_template_attribute_value_ids for ptav in iter_ptav]):