From 8fb61cd8305e2e5c580c4060068cbb7ddc683d70 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Fri, 12 Oct 2018 11:17:40 +0200 Subject: [PATCH] [FIX] product_margin: sales and purchase in invoice's currency Invoice price should be adapted to the invoice currency Before this commit, it was not. OPW 1889997 closes #27710 --- addons/product_margin/models/product_product.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/product_margin/models/product_product.py b/addons/product_margin/models/product_product.py index 8911e3bc716..dda0a0ef2dd 100644 --- a/addons/product_margin/models/product_product.py +++ b/addons/product_margin/models/product_product.py @@ -106,7 +106,7 @@ class ProductProduct(models.Model): select sum(l.price_unit * l.quantity)/nullif(sum(l.quantity),0) as avg_unit_price, sum(l.quantity) as num_qty, - sum(l.quantity * (l.price_subtotal/(nullif(l.quantity,0)))) as total, + sum(l.quantity * (l.price_subtotal_signed/(nullif(l.quantity,0)))) as total, sum(l.quantity * pt.list_price) as sale_expected from account_invoice_line l left join account_invoice i on (l.invoice_id = i.id)