From 3987d11a8098d557bf4566992eda82b3331bdf73 Mon Sep 17 00:00:00 2001 From: len-odoo Date: Tue, 27 Nov 2018 15:01:19 +0000 Subject: [PATCH] [FIX] account: use the total amount instead of the amount before rounding Create a "Cash Rounding Method" C with Rounding Precision: 0.05, Rounding Strategy: Modify tax amount, Rounding Method: DOWN. Create an invoice I with rounding of currency C, with some tax line and nonzero rounding. When you now print the invoice, the tax amount is not the same, as it shows the field "amount" instead of "amount_total". Fix courtesy of Olivier Jossen, Braintec opw 1909215 closes odoo/odoo#29079 --- addons/account/models/account_invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index fcff9a6ebec..1bb091cd849 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -1408,7 +1408,7 @@ class AccountInvoice(models.Model): res = {} for line in self.tax_line_ids: res.setdefault(line.tax_id.tax_group_id, {'base': 0.0, 'amount': 0.0}) - res[line.tax_id.tax_group_id]['amount'] += line.amount + res[line.tax_id.tax_group_id]['amount'] += line.amount_total res[line.tax_id.tax_group_id]['base'] += line.base res = sorted(res.items(), key=lambda l: l[0].sequence) res = [(