Skip to content
Snippets Groups Projects
Commit 09792602 authored by Demesmaeker's avatar Demesmaeker
Browse files

[FIX] sale_margin: correct computation of margin in groupby in the SO


For now, the sale margin is incorrectly computed in group by in the sales order.

This was done in the sales order lines in abdb85fb

opw-3180556

closes odoo/odoo#119333

Signed-off-by: default avatarMorgane Demesmaeker <edm@odoo.com>
parent 1a264d7d
Branches
Tags
No related merge requests found
......@@ -60,7 +60,9 @@ class SaleOrder(models.Model):
_inherit = "sale.order"
margin = fields.Monetary("Margin", compute='_compute_margin', store=True)
margin_percent = fields.Float("Margin (%)", compute='_compute_margin', store=True)
margin_percent = fields.Float(
"Margin (%)", compute='_compute_margin', store=True, group_operator='avg'
)
@api.depends('order_line.margin', 'amount_untaxed')
def _compute_margin(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment