From 65136589576f46a9469de8d522ed7a1b41ca5495 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Fri, 5 May 2017 15:58:15 +0200 Subject: [PATCH] [FIX] account: account_invoice_report: make the calculation of product_qty right Before this commit product quantity was computed as if the uom on the product represented the *unit* in which a product was sold Hence, in the report, it produced something like this: I sell 10 packages of something, which is sold essentially by 10 itself = which makes a total unitary quantity of 100 This wrong behavior has been introduced in 10.0 by 9c5d4cd60cc414a52c52b0f3d0048be535769838 After this commit, the computation is done to match the *standard* unit of measure in which a product quantity is *represented* OPW 741745 Closes #16834 --- addons/account/report/account_invoice_report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/report/account_invoice_report.py b/addons/account/report/account_invoice_report.py index eb969cadec4..e76f25027ff 100644 --- a/addons/account/report/account_invoice_report.py +++ b/addons/account/report/account_invoice_report.py @@ -113,7 +113,7 @@ class AccountInvoiceReport(models.Model): 1 AS nbr, ai.type, ai.state, pt.categ_id, ai.date_due, ai.account_id, ail.account_id AS account_line_id, ai.partner_bank_id, - SUM ((invoice_type.sign * ail.quantity) / (u.factor * u2.factor)) AS product_qty, + SUM ((invoice_type.sign * ail.quantity) / u.factor * u2.factor) AS product_qty, SUM(ail.price_subtotal_signed) AS price_total, SUM(ABS(ail.price_subtotal_signed)) / CASE WHEN SUM(ail.quantity / u.factor * u2.factor) <> 0::numeric