[IMP] mrp_multi_level: Get BoM to explode

When exploding requirements or calculating supply method, we will consider the first active BoM taking into account the routes.
This commit is contained in:
BernatPForgeFlow
2023-03-01 11:15:00 +01:00
committed by JasminSForgeFlow
parent 5db0c8edf6
commit 784e40e8fc
2 changed files with 49 additions and 38 deletions

View File

@@ -205,11 +205,12 @@ class ProductMRPArea(models.Model):
break
rule = new_rule
# Determine the supply method based on the final rule.
boms = rec.product_id.product_tmpl_id.bom_ids.filtered(
lambda x: x.type in ["normal", "phantom"]
)
rec.supply_method = (
"phantom"
if rule.action == "manufacture"
and rec.product_id.product_tmpl_id.bom_ids
and rec.product_id.product_tmpl_id.bom_ids[0].type == "phantom"
if rule.action == "manufacture" and boms and boms[0].type == "phantom"
else rule.action
)