From eb17528df02b742e0f739278a68f4f709dee73c1 Mon Sep 17 00:00:00 2001 From: Michele Date: Fri, 8 Sep 2023 11:52:37 +0200 Subject: [PATCH] [FIX] mrp: avoid to set product_id on mrp.bom if variants are disabled closes odoo/odoo#142202 X-original-commit: a62149cd8da5c6127dbba9f7239df732c2602362 Signed-off-by: William Henrotin (whe) --- addons/mrp/models/product.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp/models/product.py b/addons/mrp/models/product.py index 682d83b7fdb..c6b1b1e0110 100644 --- a/addons/mrp/models/product.py +++ b/addons/mrp/models/product.py @@ -275,7 +275,7 @@ class ProductProduct(models.Model): # bom specific to this variant or global to template or that contains the product as a byproduct action['context'] = { 'default_product_tmpl_id': template_ids[0], - 'default_product_id': self.ids[0], + 'default_product_id': self.env.user.has_group('product.group_product_variant') and self.ids[0] or False, } action['domain'] = ['|', '|', ('byproduct_ids.product_id', 'in', self.ids), ('product_id', 'in', self.ids), '&', ('product_id', '=', False), ('product_tmpl_id', 'in', template_ids)] return action