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

Module: DDMRP

Entity: stock.buffer

Compute Method: _compute_green_zone

Inputs Method Outputs
for rec in self:
            if rec.product_id and rec.replenish_method in ["replenish", "min_max"]:
                # Using imposed or desired minimum order cycle
                rec.green_zone_oc = float_round(
                    rec.order_cycle * rec.adu,
                    precision_rounding=rec.product_uom.rounding,
                )
                # Using lead time factor
                dlt = rec.dlt + rec.extra_lead_time
                rec.green_zone_lt_factor = float_round(
                    dlt * rec.adu * rec.buffer_profile_id.lead_time_id.factor,
                    precision_rounding=rec.product_uom.rounding,
                )
                # Using minimum order quantity
                rec.green_zone_moq = float_round(
                    rec.minimum_order_quantity,
                    precision_rounding=rec.product_uom.rounding,
                )

                # The biggest option of the above will be used as the green
                # zone value
                rec.green_zone_qty = max(
                    rec.green_zone_oc, rec.green_zone_lt_factor, rec.green_zone_moq
                )
            elif rec.product_id and rec.replenish_method == "replenish_override":
                rec.green_zone_qty = rec.green_override
            else:
                rec.green_zone_qty = 0.0
            rec.top_of_green = rec.green_zone_qty + rec.top_of_yellow

Back to entity