Wrong payload on issued invoice to SII with multiple taxes
When an invoice has multiple lines featuring diverse taxes, e.g. basic food or cultural services will be applied a reduced 10% tax while most goods and services are applied the general 21% tax in Spain, the SII webservice expects the tax detail payload to be something like
Sujeta: {
NoExenta: {
DesgloseIVA: {
DetalleIVA: [
{TipoImpositivo: 10, BaseImponible: 1000, CuotaRepercutida: 100},
{TipoImpositivo: 21, BaseImponible: 1000, CuotaRepercutida: 210},
]
}
}
}
See python -m zeep https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/ssii_1_1_bis/fact/ws/SuministroFactEmitidas.wsdl | grep SujetaType
But the trytond module produces something like
Sujeta: [
{ NoExenta: { DesgloseIVA: { DetalleIVA: {TipoImpositivo: 10, BaseImponible: 1000, CuotaRepercutida: 100 }}}},
{ NoExenta: { DesgloseIVA: { DetalleIVA: {TipoImpositivo: 21, BaseImponible: 1000, CuotaRepercutida: 210 }}}},
]
and the underlying zeep library discards the extra information, causing the SII service to reject the invoice because of a mismatch in the reported amounts.