[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
This commit is contained in:
len-odoo
2018-11-28 13:03:01 +00:00
parent f9c483d9f5
commit 3987d11a80
+1 -1
View File
@@ -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 = [(