[FIX] l10n_es_edi_sii: export regimen key should depend on taxes

We made it depend on the partner country, but it is better to
identify it through the tax being used.  E.g. it is only the
exportation of goods that is needed to change the regimen
and not the services.

We also needed to change the test, because we used E2 with
a Belgian partner.

opw-3514270

closes odoo/odoo#137184

X-original-commit: 14d5be171e238d7aa12f513659929b5b940eea78
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Josse Colpaert <jco@odoo.com>
This commit is contained in:
Josse Colpaert
2023-10-03 15:37:33 +00:00
parent ccd9dd7ca9
commit 73de649796
2 changed files with 3 additions and 6 deletions
@@ -286,11 +286,8 @@ class AccountEdiFormat(models.Model):
**partner_info,
'NombreRazon': com_partner.name[:120],
}
if not com_partner.country_id or com_partner.country_id.code in eu_country_codes:
invoice_node['ClaveRegimenEspecialOTrascendencia'] = '01'
else:
invoice_node['ClaveRegimenEspecialOTrascendencia'] = '02'
export_exempts = invoice.invoice_line_ids.tax_ids.filtered(lambda t: t.l10n_es_exempt_reason == 'E2')
invoice_node['ClaveRegimenEspecialOTrascendencia'] = '02' if export_exempts else '01'
else:
info['IDFactura']['IDEmisorFactura'] = partner_info
info['IDFactura']['NumSerieFacturaEmisor'] = invoice.ref[:60]
+1 -1
View File
@@ -446,7 +446,7 @@ class TestEdiXmls(TestEsEdiCommon):
'PeriodoLiquidacion': {'Ejercicio': '2019', 'Periodo': '01'},
'FacturaExpedida': {
'TipoFactura': 'F1',
'ClaveRegimenEspecialOTrascendencia': '01',
'ClaveRegimenEspecialOTrascendencia': '02',
'DescripcionOperacion': 'manual',
'TipoDesglose': {
'DesgloseTipoOperacion': {