[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) <vfe@odoo.com>
This commit is contained in:
Victor Feyens
2020-05-26 10:14:02 +00:00
parent 66240a8536
commit a624567cd8
+1 -1
View File
@@ -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
'''