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

Module: Inventory

Entity: stock.move.line

Compute Method: _compute_quantity

Inputs Method Outputs
for record in self:
            if not record.quant_id or record.quantity:
                continue
            uom_id = record.product_id.uom_id
            sml_uom = record.uom_id
            move_visible_quantity = record.move_id and record.move_id._visible_quantity() or 0.0

            move_demand = record.move_id.uom_id._compute_quantity(record.move_id.product_uom_qty, sml_uom, rounding_method='HALF-UP')
            move_quantity = record.move_id.uom_id._compute_quantity(move_visible_quantity, sml_uom, rounding_method='HALF-UP')
            quant_qty = uom_id._compute_quantity(record.quant_id.available_quantity, sml_uom, rounding_method='HALF-UP')

            if sml_uom.compare(move_demand, move_quantity) > 0:
                record.quantity = max(0, min(quant_qty, move_demand - move_quantity))
            else:
                record.quantity = max(0, quant_qty)

Back to entity