Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.
Module: Margins in Sales Orders
Entity: sale.order.line
Compute Method: _compute_margin
| Inputs | Method | Outputs |
|---|---|---|
|
for line in self: - # Find alternative calculation when line is added to order from delivery - if line.qty_delivered and not line.product_uom_qty: - calculated_subtotal = line.price_unit * line.qty_delivered - line.margin = calculated_subtotal - (line.purchase_price * line.qty_delivered) - line.margin_percent = calculated_subtotal and line.margin / calculated_subtotal - else: - line.margin = line.price_subtotal - (line.purchase_price * line.product_uom_qty) - line.margin_percent = line.price_subtotal and line.margin / line.price_subtotal + total_cost = line.purchase_price * line._get_product_qty() + line.margin = line._get_subtotal() - total_cost |
|
