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

Module: Update costs from purchase

Entity: purchase.order.line

Compute Method: _compute_valuation_differs

Inputs Method Outputs
  • currency_id
  • currency_id.rounding
"""We can only propagate the cost change when there are quantities received
        and there aren't invoices"""
self.valuation_differs = False
for line in self.filtered(
            lambda x: x.price_unit
            and x.qty_received
            and not x.qty_invoiced
            and x.product_id.cost_method == "average"
        ):
            (price_unit, svl_qty, price_diff, _) = line._get_valuation_diff_values()
            if (
                float_compare(
                    price_diff, 0, precision_rounding=line.currency_id.rounding
                )
                != 0
            ):
                line.valuation_differs = True
                line.valuation_difference = price_diff

Back to entity