[FIX] mrp_multi_level: Manage Kits in MRP Multi Level

This commit is contained in:
Bernat Puig Font
2022-09-05 17:47:59 +02:00
parent 38ac8c9b96
commit b2f75ca610
8 changed files with 226 additions and 15 deletions

View File

@@ -78,6 +78,7 @@ class ProductMRPArea(models.Model):
("buy", "Buy"),
("none", "Undefined"),
("manufacture", "Produce"),
("phantom", "Kit"),
("pull", "Pull From"),
("push", "Push To"),
("pull_push", "Pull & Push"),
@@ -182,7 +183,14 @@ class ProductMRPArea(models.Model):
"company_id": rec.mrp_area_id.company_id,
}
rule = group_obj._get_rule(rec.product_id, proc_loc, values)
rec.supply_method = rule.action if rule else "none"
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"
):
rec.supply_method = "phantom"
else:
rec.supply_method = rule.action if rule else "none"
@api.depends("supply_method", "product_id.route_ids", "product_id.seller_ids")
def _compute_main_supplier(self):
@@ -263,7 +271,4 @@ class ProductMRPArea(models.Model):
def _to_be_exploded(self):
self.ensure_one()
if self.supply_method == "manufacture":
return True
else:
return False
return self.supply_method in ["manufacture", "phantom"]