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

Module: Sales

Entity: sale.order.line

Compute Method: _compute_qty_delivered_method

Inputs Method Outputs
"""Compute the method used to compute the quantity delivered for the given lines.

        Available choices in `sale`:

        - analytic (sum of analytic unit_amount)
        - manual (set manually on SOL)
        """
self.qty_delivered_method = "manual"
for line in self:
            if line.is_expense:
                line.qty_delivered_method = "analytic"
            elif line.product_id.type == "service":
                line.qty_delivered_method = line.product_id.service_type
            elif line.product_id.type == "consu":
                line.qty_delivered_method = line._get_consu_qty_delivered_method()

            # If product has a reinvoice policy and no specific delivered method, its delivered
            # quantities should still be computed through analytic lines.
            # For other delivery methods, they are expected to add their own quantities to the
            # quantities already provided by the `_prepare_qty_delivered` method, including
            # analytic lines quantities for reinvoiceable products.
            if (
                line.qty_delivered_method == "manual"
                and line.product_id
                and line.product_id.reinvoice_policy != "no"
            ):
                line.qty_delivered_method = "analytic"

Back to entity