From ccd9dd7ca9ebd89a134c375dfa6ab26f35de3ced Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Thu, 28 Sep 2023 15:05:54 +0200 Subject: [PATCH] [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 --- addons/l10n_es_edi_sii/models/account_edi_format.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/l10n_es_edi_sii/models/account_edi_format.py b/addons/l10n_es_edi_sii/models/account_edi_format.py index 02dffb8c674..54815554973 100644 --- a/addons/l10n_es_edi_sii/models/account_edi_format.py +++ b/addons/l10n_es_edi_sii/models/account_edi_format.py @@ -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'