From e1b3f32d11b14fec110b522933838ad2ec82bb0e Mon Sep 17 00:00:00 2001 From: "Andrea Grazioso (agr-odoo)" Date: Thu, 23 Mar 2023 10:02:43 +0000 Subject: [PATCH] [FIX] account: invoice analysis total always positive Create a Credit Note, save and confirm Go to Reporting>Invoice Analysis Switch to Pivot view, add mesures ntaxed Total and Total, expand rows by Move. The credit note untaxed total is correctly reported as negative, total is reported as positive opw-3223043 closes odoo/odoo#116421 X-original-commit: 06b1f3d0c78fc22250fc544b4c3152a58bfbe05c Signed-off-by: John Laterre (jol) --- addons/account/report/account_invoice_report.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/account/report/account_invoice_report.py b/addons/account/report/account_invoice_report.py index 7beb151aa31..59eae586c8d 100644 --- a/addons/account/report/account_invoice_report.py +++ b/addons/account/report/account_invoice_report.py @@ -98,7 +98,8 @@ class AccountInvoiceReport(models.Model): line.quantity / NULLIF(COALESCE(uom_line.factor, 1) / COALESCE(uom_template.factor, 1), 0.0) * (CASE WHEN move.move_type IN ('in_invoice','out_refund','in_receipt') THEN -1 ELSE 1 END) AS quantity, -line.balance * currency_table.rate AS price_subtotal, - line.price_total, + line.price_total * (CASE WHEN move.move_type IN ('in_invoice','out_refund','in_receipt') THEN -1 ELSE 1 END) + AS price_total, -COALESCE( -- Average line price (line.balance / NULLIF(line.quantity, 0.0)) * (CASE WHEN move.move_type IN ('in_invoice','out_refund','in_receipt') THEN -1 ELSE 1 END)