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

Module: Purchase Agreements

Entity: purchase.requisition.line

Compute Method: _compute_ordered_qty

Inputs Method Outputs
line_found = defaultdict(set)
for line in self:
            if line.display_type:
                line.qty_ordered = 0
                continue
            total = 0.0
            for po in line.requisition_id.purchase_ids.filtered(lambda purchase_order: purchase_order.state == 'purchase'):
                for po_line in po.order_line.filtered(lambda order_line: order_line.product_id == line.product_id):
                    if po_line.uom_id != line.uom_id:
                        total += po_line.uom_id._compute_quantity(po_line.product_qty, line.uom_id)
                    else:
                        total += po_line.product_qty
            if line.product_id not in line_found[line.requisition_id]:
                line.qty_ordered = total
                line_found[line.requisition_id].add(line.product_id)
            else:
                line.qty_ordered = 0

Back to entity