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

Module: Sale shipping info helper

Entity: sale.order

Compute Method: _compute_shipping

View 18.0
Inputs Method Outputs
  • order_line
- for record in self:
-             # Get delivery lines
-             delivery_lines = record.order_line.filtered(lambda x: x._is_delivery())
- 
-             # Compute shipping amounts
-             shipping_amount_untaxed = sum(delivery_lines.mapped("price_subtotal"))
-             shipping_amount_total = sum(delivery_lines.mapped("price_total"))
-             shipping_amount_tax = sum(delivery_lines.mapped("price_tax"))
-             record.update(
-                 {
-                     "shipping_amount_untaxed": shipping_amount_untaxed,
-                     "shipping_amount_total": shipping_amount_total,
-                     "shipping_amount_tax": shipping_amount_tax,
-                 }
-             )
-             for key in ["amount_total", "amount_untaxed", "amount_tax"]:
-                 record[f"item_{key}"] = record[key] - record[f"shipping_{key}"]

Back to entity