diff --git a/addons/account/report/account_invoice_report.py b/addons/account/report/account_invoice_report.py index 05be7856475..71adc047fec 100644 --- a/addons/account/report/account_invoice_report.py +++ b/addons/account/report/account_invoice_report.py @@ -100,7 +100,7 @@ class AccountInvoiceReport(models.Model): -line.balance * currency_table.rate AS price_subtotal, -COALESCE( -- Average line price - (line.balance / NULLIF(line.quantity, 0.0)) + (line.balance / NULLIF(line.quantity, 0.0)) * (CASE WHEN move.move_type IN ('in_invoice','out_refund','in_receipt') THEN -1 ELSE 1 END) -- convert to template uom * (NULLIF(COALESCE(uom_line.factor, 1), 0.0) / NULLIF(COALESCE(uom_template.factor, 1), 0.0)), 0.0) * currency_table.rate AS price_average, diff --git a/addons/account/tests/test_account_invoice_report.py b/addons/account/tests/test_account_invoice_report.py index 1a4526cd038..d1458036c9d 100644 --- a/addons/account/tests/test_account_invoice_report.py +++ b/addons/account/tests/test_account_invoice_report.py @@ -103,6 +103,7 @@ class TestAccountInvoiceReport(AccountTestInvoicingCommon): 'price_subtotal': vals[1], 'quantity': vals[2], } for vals in expected_values_list] + self.assertRecordValues(reports, expected_values_dict) def test_invoice_report_multiple_types(self): @@ -112,7 +113,7 @@ class TestAccountInvoiceReport(AccountTestInvoicingCommon): [1000, 1000, 1], [250, 750, 3], [6, 6, 1], - [-20, -20, -1], - [-20, -20, -1], - [-600, -600, -1], + [20, -20, -1], + [20, -20, -1], + [600, -600, -1], ])