[FIX] l10n_es_edi_sii: intracom should be identified by tags, not country

We use the casilla 10 and 11 of the modelo 303 to identify intra-community
instead.

This way, the tax defines the regime that should be used.

opw-3514270

X-original-commit: eb287e911afc652c122b44c39af4b6d6b11bf618
Part-of: odoo/odoo#137184
This commit is contained in:
Josse Colpaert
2023-10-03 15:37:33 +00:00
parent 00875e2654
commit ccd9dd7ca9
@@ -305,11 +305,11 @@ class AccountEdiFormat(models.Model):
else:
invoice_node['FechaRegContable'] = fields.Date.context_today(self).strftime('%d-%m-%Y')
country_code = com_partner.country_id.code
if not country_code or country_code == 'ES' or country_code not in eu_country_codes:
invoice_node['ClaveRegimenEspecialOTrascendencia'] = '01'
else:
invoice_node['ClaveRegimenEspecialOTrascendencia'] = '09' # For Intra-Com
mod_303_10 = self.env.ref('l10n_es.mod_303_10')
mod_303_11 = self.env.ref('l10n_es.mod_303_11')
tax_tags = invoice.line_ids.tax_tag_ids
intracom = mod_303_10 in tax_tags or mod_303_11 in tax_tags
invoice_node['ClaveRegimenEspecialOTrascendencia'] = '09' if intracom else '01'
if invoice.move_type == 'out_invoice':
invoice_node['TipoFactura'] = 'F2' if is_simplified else 'F1'