From ad3902f1f1421655f11c10edab1e6cbfb92ed34c Mon Sep 17 00:00:00 2001 From: Akim Juillerat Date: Mon, 11 Nov 2024 16:59:23 +0100 Subject: [PATCH] [FIX] mrp_bom_attribute_match: Do not empty bom line uom when creating When creating a new line, an onchange is played before the user selects the product. With the previous code, since no product was selected, this was emptying the default value. This was in turn breaking any other function that relied on this value being set. --- mrp_bom_attribute_match/models/mrp_bom.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mrp_bom_attribute_match/models/mrp_bom.py b/mrp_bom_attribute_match/models/mrp_bom.py index 11992d9956..de92fcc12f 100644 --- a/mrp_bom_attribute_match/models/mrp_bom.py +++ b/mrp_bom_attribute_match/models/mrp_bom.py @@ -85,7 +85,11 @@ def _onchange_component_template_id(self): if self.product_backup_id: self.product_id = self.product_backup_id self.product_backup_id = False - if self.product_uom_id.category_id != self.product_id.uom_id.category_id: + if ( + self.product_id.uom_id + and self.product_uom_id.category_id + != self.product_id.uom_id.category_id + ): self.product_uom_id = self.product_id.uom_id @api.depends("component_template_id")