[FIX] mrp: ensure only active BoMs are considered on product2bom

When executing the product2bom method it is possible that an active_test
context is present in self. However, the method should not consider
archived BoMs.

closes odoo/odoo#104919

X-original-commit: a5f923859fad37e1fc52a3a4bcce5cce4cf69c87
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This commit is contained in:
JordiMForgeFlow
2022-11-04 09:53:02 +01:00
committed by William Henrotin
parent 01703e3ac8
commit 2ad702f239
+1 -1
View File
@@ -224,7 +224,7 @@ class MrpBom(models.Model):
@api.model
def _bom_find_domain(self, products, picking_type=None, company_id=False, bom_type=False):
domain = ['|', ('product_id', 'in', products.ids), '&', ('product_id', '=', False), ('product_tmpl_id', 'in', products.product_tmpl_id.ids)]
domain = ['|', ('product_id', 'in', products.ids), '&', '&', ('product_id', '=', False), ('product_tmpl_id', 'in', products.product_tmpl_id.ids), ('active', '=', True)]
if company_id or self.env.context.get('company_id'):
domain = AND([domain, ['|', ('company_id', '=', False), ('company_id', '=', company_id or self.env.context.get('company_id'))]])
if picking_type: