Skip to content

[17.0][‎‎l10n_es_vat_book] DUA grouped tax error #4652

@ValentinVinagre

Description

@ValentinVinagre

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:

  1. Create an invoice with a grouped tax (DUA).
  2. Validate the invoice.
  3. Generate a VAT ledger for the invoice period.
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions