[FIX] l10n_es_edi_tbai: similar to sii clave regimen 02 is only exports of goods

opw-3716413

closes odoo/odoo#152125

Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
This commit is contained in:
Josse Colpaert
2024-02-03 05:20:40 +00:00
parent 1bb1a95ab8
commit f9dfe9cec2
@@ -360,11 +360,8 @@ class AccountEdiFormat(models.Model):
# Regime codes (ClaveRegimenEspecialOTrascendencia)
# NOTE there's 11 more codes to implement, also there can be up to 3 in total
# See https://www.gipuzkoa.eus/documents/2456431/13761128/Anexo+I.pdf/2ab0116c-25b4-f16a-440e-c299952d683d
com_partner = invoice.commercial_partner_id
if not com_partner.country_id or com_partner.country_id.code in self.env.ref('base.europe').country_ids.mapped('code'):
values['regime_key'] = ['01']
else:
values['regime_key'] = ['02']
export_exempts = invoice.invoice_line_ids.tax_ids.filtered(lambda t: t.l10n_es_exempt_reason == 'E2')
values['regime_key'] = ['02'] if export_exempts else ['01']
if invoice.l10n_es_is_simplified:
values['regime_key'].append(52) # code for simplified invoices