Skip to content

Commit 1359adf

Browse files
committed
[FIX] l10n_es_atc_sii_oca: Identifier type '02' for Contraparte not exists in SII atc
TT60254
1 parent 4b700ef commit 1359adf

3 files changed

Lines changed: 40 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
from . import account_move
2+
from . import res_partner

l10n_es_atc_sii_oca/models/account_move.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,10 @@ def _get_aeat_invoice_dict_in(self, cancel=False):
6262
):
6363
inv_dict = self._sii_atc_replace_tax_keys(inv_dict)
6464
return inv_dict
65+
66+
def _get_sii_identifier(self):
67+
if self._get_sii_tax_agency() == self.env.ref(
68+
"l10n_es_aeat.aeat_tax_agency_canarias"
69+
):
70+
self = self.with_context(is_canary_tax_agency=True)
71+
return super()._get_sii_identifier()
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright 2026 Tecnativa - Carlos Dauden
2+
# Copyright 2026 Tecnativa - Sergio Teruel
3+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
4+
5+
from odoo import models
6+
from odoo.tools import ormcache_context
7+
8+
9+
class ResPartner(models.Model):
10+
_inherit = "res.partner"
11+
12+
@ormcache_context("self.vat, self.country_id", keys=("is_canary_tax_agency",))
13+
def _parse_aeat_vat_info(self):
14+
# NOTE:
15+
# The Canary Islands Tax Agency (ATC) SII-IGIC implementation does NOT support
16+
# IDType "02" (EU VAT number / NIF-IVA) used by the Spanish AEAT SII (VAT).
17+
#
18+
# Although the data structure is similar, ATC does not validate intra-community
19+
# operators nor VIES registrations, since IGIC is not VAT.
20+
#
21+
# As a result, foreign VAT numbers must be reported using IDType "04"
22+
# ("Official identification document") instead of "02".
23+
#
24+
# Using IDType "02" causes ATC to reject the record with error code 1103
25+
# ("Valor del campo IDType incorrecto").
26+
#
27+
# This conversion is intentional and required for SII submissions to ATC.
28+
country_code, identifier_type, identifier = super()._parse_aeat_vat_info()
29+
is_canary_tax_agency = self.env.context.get("is_canary_tax_agency")
30+
if is_canary_tax_agency and identifier_type == "02":
31+
identifier_type = "04"
32+
return country_code, identifier_type, identifier

0 commit comments

Comments
 (0)