-
-
Notifications
You must be signed in to change notification settings - Fork 574
Open
Labels
Description
The VAT book calculation gives an error when grouped taxes are used.
Module
l10n_es_vat_book
Describe the bug
The VAT ledger calculation returns an error when grouped taxes are used. The system attempts to find the grouped tax used in the invoice line within the journal entries and returns a key error.
| vat_book_line["base_amount"] += res[tax]["base"] |
To Reproduce
All those that contain the following commit-> 8744339
Steps to reproduce the behavior:
- Create an invoice with a grouped tax (DUA).
- Validate the invoice.
- Generate a VAT ledger for the invoice period.
- A key error will be displayed.
Error/debug line
Contents of the "res" dictionary:
2025-12-05 10:11:00,281 1 ERROR test_02_12_25 root: {account.tax(9,): {'tax': account.tax(9,), 'base': 10653.28, 'amount': 0, 'deductible_amount': 0}, account.tax(154,): {'tax': account.tax(154,), 'base': 10653.28, 'amount': 0, 'deductible_amount': 0}}
Error returned by the system:
File "/opt/odoo/auto/addons/l10n_es_vat_book/models/l10n_es_vat_book.py", line 283, in upsert_book_line_tax
odoo-1 | vat_book_line["base_amount"] += res[tax]["base"]
odoo-1 | KeyError: account.tax(157,)
As can see, the system tries to search for the tax grouped by the tax breakdowns. Something at this point has not been changed correctly in the commit.