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

Module: Purchase Open Qty

Entity: purchase.order.line

Compute Method: _compute_qty_to_receive

Inputs Method Outputs
  • product_uom
  • product_uom_qty
  • product_qty
  • qty_received
"""Compute the quantity for which there are pending stock moves"""
service_lines = self.filtered(lambda line: line.product_id.type == "service")
for line in self - service_lines:
            total = 0.0
            for move in line.move_ids.filtered(
                lambda m: m.state not in ("cancel", "done")
            ):
                if move.product_uom != line.product_uom:
                    total += move.product_uom._compute_quantity(
                        move.product_uom_qty, line.product_uom
                    )
                else:
                    total += move.product_uom_qty
            line.qty_to_receive = total
for line in service_lines:
            line.qty_to_receive = line.product_qty - line.qty_received

Back to entity