Update the way that take the last invoice register

This commit is contained in:
Bernat Brunet Torruella 2018-11-05 00:29:57 +01:00
parent dace29bbde
commit 585ead2857
1 changed files with 2 additions and 2 deletions

View File

@ -587,7 +587,7 @@ class SIIReport(Workflow, ModelSQL, ModelView):
for invoice in invoices_list for invoice in invoices_list
} }
pagination = res.IndicadorPaginacion pagination = res.IndicadorPaginacion
last_invoice = invoices_list[-1] last_invoice = registers[-1].IDFactura
lines_to_create = [] lines_to_create = []
for reg in registers: for reg in registers:
taxes_to_create = [] taxes_to_create = []
@ -749,6 +749,7 @@ class SIIReport(Workflow, ModelSQL, ModelView):
_logger.debug(res) _logger.debug(res)
registers = res.RegistroRespuestaConsultaLRFacturasRecibidas registers = res.RegistroRespuestaConsultaLRFacturasRecibidas
pagination = res.IndicadorPaginacion pagination = res.IndicadorPaginacion
last_invoice = registers[-1].IDFactura
# FIXME: the reference is not forced to be unique # FIXME: the reference is not forced to be unique
lines_to_create = [] lines_to_create = []
@ -840,7 +841,6 @@ class SIIReport(Workflow, ModelSQL, ModelView):
break break
if invoices: if invoices:
sii_report_line['invoice'] = invoices[0].id sii_report_line['invoice'] = invoices[0].id
last_invoice = invoices[0]
lines_to_create.append(sii_report_line) lines_to_create.append(sii_report_line)
SIIReportLine.create(lines_to_create) SIIReportLine.create(lines_to_create)