[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) <whe@odoo.com>
This commit is contained in:
Michele
2023-11-15 18:12:02 +00:00
parent b74ca03bcb
commit eb17528df0
+1 -1
View File
@@ -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