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

Module: Delivery costs in purchases

Entity: purchase.order

Compute Method: _compute_delivery_price

Inputs Method Outputs
for item in self.filtered(lambda x: x.carrier_id):
            delivery_lines = item.order_line.filtered(lambda x: x.is_delivery)
            if delivery_lines:
                item.delivery_price = sum(delivery_lines.mapped("price_unit"))
            elif item.state not in ("purchase", "done", "cancel"):
                item.delivery_price = item.carrier_id.purchase_rate_shipment(item)[
                    "price"
                ]

Back to entity