From a624567cd817eac8624ee03c6a1f1b3711fcded0 Mon Sep 17 00:00:00 2001 From: Victor Feyens Date: Mon, 25 May 2020 13:13:56 +0000 Subject: [PATCH] [FIX] pos_sale: sale.report discount_amount computation The pos.order.line quantity wasn't considered when computing the discount amount. E.g. buying 5 products (1$) at 50% would only show 0.5$ as discount_amount, instead of 2.5$. Followup of #43587 closes odoo/odoo#51872 X-original-commit: 96e96284fceb2f68838c85f04c40da65176eb006 Signed-off-by: Victor Feyens (vfe) --- addons/pos_sale/report/sale_report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/pos_sale/report/sale_report.py b/addons/pos_sale/report/sale_report.py index 4618651ec2c..374013aad4f 100644 --- a/addons/pos_sale/report/sale_report.py +++ b/addons/pos_sale/report/sale_report.py @@ -62,7 +62,7 @@ class SaleReport(models.Model): left join product_template t on (p.product_tmpl_id=t.id) left join uom_uom u on (u.id=t.uom_id)) AS volume, l.discount as discount, - sum((l.price_unit * l.discount / 100.0 / CASE COALESCE(pos.currency_rate, 0) WHEN 0 THEN 1.0 ELSE pos.currency_rate END)) as discount_amount, + sum((l.price_unit * l.discount * l.qty / 100.0 / CASE COALESCE(pos.currency_rate, 0) WHEN 0 THEN 1.0 ELSE pos.currency_rate END)) as discount_amount, NULL as order_id '''