[FIX] account: fix 0% taxes shown on invoice print

- Install Invoicing
- Go to Invoicing > Configuration > Taxes
- Create a Tax 0% with its own tax group
- Go to Invoicing > Customers > Invoices
- Create an Invoice with a line having a normal Tax and several lines with Tax 0%
- Confirm and print Invoice
On the Subtotal section of the printed invoice, for the label of the Tax Group of Tax 0%,
only the amount of the first line having this tax is shown.
(i.e. "Tax 0% on $ XXX", where XXX should be the sum of all lines on which Tax 0% is applied)

opw-2381051

closes odoo/odoo#62106

X-original-commit: 9e244ae3053f46fc22b8e9a75015d57cd70053b8
Signed-off-by: Anh Thao PHAM <kitan191@users.noreply.github.com>
This commit is contained in:
Anh Thao Pham (pta)
2020-11-20 15:06:41 +00:00
parent 05b151d4e4
commit d897c73852
+3 -1
View File
@@ -1486,11 +1486,13 @@ class AccountMove(models.Model):
# At this point we only want to keep the taxes with a zero amount since they do not
# generate a tax line.
zero_taxes = set()
for line in move.line_ids:
for tax in line.tax_ids.flatten_taxes_hierarchy():
if tax.tax_group_id not in res:
if tax.tax_group_id not in res or tax.tax_group_id in zero_taxes:
res.setdefault(tax.tax_group_id, {'base': 0.0, 'amount': 0.0})
res[tax.tax_group_id]['base'] += tax_balance_multiplicator * (line.amount_currency if line.currency_id else line.balance)
zero_taxes.add(tax.tax_group_id)
res = sorted(res.items(), key=lambda l: l[0].sequence)
move.amount_by_group = [(