addons-cm/l10n_es_edi_tbai_reagyp_recibidas/models/account_move.py
GitHub Copilot 66a5e31060 [ADD] l10n_es_edi_tbai_reagyp_recibidas: fix REAGYP vendor bill regime key
Native l10n_es_edi_tbai hardcodes ClaveRegimenIvaOpTrascendencia '19' for
REAGYP vendor bills, but '19' only exists in the issued-invoices book. The
Batuz LROE schema for received invoices rejects it (cvc-enumeration-valid),
where the valid REAGYP-compensation key is '02'.

Override _l10n_es_tbai_get_vendor_bill_values_batuz to remap 19 -> 02.
Upstream: https://github.com/odoo/odoo/pull/266214

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-25 14:12:16 +02:00

16 lines
647 B
Python

# Copyright 2026 - Today Criptomart
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models
class AccountMove(models.Model):
_inherit = "account.move"
def _l10n_es_tbai_get_vendor_bill_values_batuz(self):
values = super()._l10n_es_tbai_get_vendor_bill_values_batuz()
# Clave 19 (REAGYP) sólo existe en el libro de facturas emitidas. En
# facturas recibidas, la compensación REAGYP se declara con la clave 02,
# única válida en el esquema LROE de recibidas.
if values.get("regime_key") == ["19"]:
values["regime_key"] = ["02"]
return values