odoo/odoo#202905

Created by fw-bot
Merged at 87ad5a8ca68de3a91e130fbb176f473d17f8b89b

Statuses:

label
odoo-dev:17.0-16.0-l10n_es_edi_tbai-fix-use-desglose-factura-loug-420635-fw
head
34943f93c0c2eca6d20ead53b0207dd9fc37e789
merged
3 months ago by Training, Louis Gobert (loug)
odoo/odoo
16.0 #200391
17.0 #202905
saas-17.4 #203011
18.0 #203018
saas-18.1 #203186
saas-18.2 #203188
saas-18.3
master #203192

[FW][FIX] l10n_es_edi_tbai: Correct DesgloseFactura for Bizkaia

An error occurs when a simplified invoice contains an OSS with a non-Spanish partner, and the Bizkaia tax agency is selected. This causes the B4_2000027 error to be returned by Bizkaia.

Steps to reproduce:
- Install l10n_es_edi_tbai and l10n_eu_oss
- Set the Tax Agency to Bizkaia
- Create a simplified invoice
- Set fiscal position to OSS B2C - Poland
- Use a Polish partner
- Add a product
- Validate the invoice
- Attempt to send to Bizkaia

The error raised is:
B4_1000002: Todos los registros incluidos en la petición son incorrectos. B4_2000027: La factura contiene un Tipo de desglose incorrecto. Ha de ser a nivel de operación cuando la factura es completa y, además, existe destinatario extranjero (tipo IDOtro o que sea NIF que empiece por N) o la Clave de IVA es 02.

After investigation, it appears this issue occurs only with Bizkaia. This fix ensures that DesgloseFactura is used instead of DesgloseTipoOperacion for this specific case.

Reference:
https://sede.agenciatributaria.gob.es/static_files/Sede/Procedimiento_ayuda/G417/FicherosSuministros/V_1_1/SII_Descripcion_ServicioWeb_v1.1_en_gb.pdf?utm_source=chatgpt.com

Ticket link
opw-4464223

Forward-Port-Of: #200391