[FIX] sale: prevent div by zero in sale.report

Backporting the behavior of v12 from e8f01b94ce

OPW 1916964

closes odoo/odoo#29472
This commit is contained in:
Lucas Perais (lpe)
2018-12-12 14:01:49 +00:00
parent a6d1353591
commit 6cd12694d8
+4 -4
View File
@@ -56,10 +56,10 @@ class SaleReport(models.Model):
sum(l.qty_delivered / u.factor * u2.factor) as qty_delivered,
sum(l.qty_invoiced / u.factor * u2.factor) as qty_invoiced,
sum(l.qty_to_invoice / u.factor * u2.factor) as qty_to_invoice,
sum(l.price_total / COALESCE(cr.rate, 1.0)) as price_total,
sum(l.price_subtotal / COALESCE(cr.rate, 1.0)) as price_subtotal,
sum(l.amt_to_invoice / COALESCE(cr.rate, 1.0)) as amt_to_invoice,
sum(l.amt_invoiced / COALESCE(cr.rate, 1.0)) as amt_invoiced,
sum(l.price_total / COALESCE(NULLIF(cr.rate, 0), 1.0)) as price_total,
sum(l.price_subtotal / COALESCE(NULLIF(cr.rate, 0), 1.0)) as price_subtotal,
sum(l.amt_to_invoice / COALESCE(NULLIF(cr.rate, 0), 1.0)) as amt_to_invoice,
sum(l.amt_invoiced / COALESCE(NULLIF(cr.rate, 0), 1.0)) as amt_invoiced,
count(*) as nbr,
s.name as name,
s.date_order as date,