Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: MRP Multi Level

Entity: product.mrp.area

Compute Method: _compute_supply_method

Inputs Method Outputs
boms_by_product = self.env["mrp.bom"]._bom_find(self.mapped("product_id"))
for rec in self:
            rule = rec._get_rule()
            bom = boms_by_product.get(rec.product_id, self.env["mrp.bom"])
            if bom.type == "phantom":
                rec.supply_method = "phantom"
                rec.supply_bom_id = bom
            elif not rule:
                rec.supply_method = "none"
                rec.supply_bom_id = False
            elif rule.action == "manufacture":
                rec.supply_method = rule.action
                rec.supply_bom_id = bom
            else:
                rec.supply_method = rule.action
                rec.supply_bom_id = False

Back to entity