Fix errors when query issued and received invoices.

This commit refs #21251
This commit is contained in:
José Antonio Díaz Miralles 2021-12-17 12:09:57 +01:00
parent e04ee7ac22
commit 0815ecc62a
1 changed files with 20 additions and 19 deletions

View File

@ -671,6 +671,7 @@ class SIIReport(Workflow, ModelSQL, ModelView):
else:
sujeta = tipo_desglose.DesgloseTipoOperacion.Entrega.Sujeta
if sujeta:
if sujeta.NoExenta:
for detail in sujeta.NoExenta.DesgloseIVA.DetalleIVA:
taxes_to_create.append({
@ -843,7 +844,7 @@ class SIIReport(Workflow, ModelSQL, ModelView):
_logger.debug(res)
registers = res.RegistroRespuestaConsultaLRFacturasRecibidas
pagination = res.IndicadorPaginacion
last_invoice = registers[-1].IDFactura
last_invoice = registers and registers[-1].IDFactura or None
# FIXME: the reference is not forced to be unique
lines_to_create = []