Merge PR #848 into 13.0

Signed-off-by LoisRForgeFlow
This commit is contained in:
OCA-git-bot
2022-09-20 11:54:54 +00:00
8 changed files with 225 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(
"mrp_area_id", "supply_method", "product_id.route_ids", "product_id.seller_ids"
@@ -264,7 +272,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"]