Fix errors when query issued and received invoices.
This commit refs #21251
This commit is contained in:
parent
e04ee7ac22
commit
0815ecc62a
39
aeat.py
39
aeat.py
|
@ -671,24 +671,25 @@ class SIIReport(Workflow, ModelSQL, ModelView):
|
||||||
else:
|
else:
|
||||||
sujeta = tipo_desglose.DesgloseTipoOperacion.Entrega.Sujeta
|
sujeta = tipo_desglose.DesgloseTipoOperacion.Entrega.Sujeta
|
||||||
|
|
||||||
if sujeta.NoExenta:
|
if sujeta:
|
||||||
for detail in sujeta.NoExenta.DesgloseIVA.DetalleIVA:
|
if sujeta.NoExenta:
|
||||||
taxes_to_create.append({
|
for detail in sujeta.NoExenta.DesgloseIVA.DetalleIVA:
|
||||||
'base': _decimal(detail.BaseImponible),
|
taxes_to_create.append({
|
||||||
'rate': _decimal(detail.TipoImpositivo),
|
'base': _decimal(detail.BaseImponible),
|
||||||
'amount': _decimal(detail.CuotaRepercutida),
|
'rate': _decimal(detail.TipoImpositivo),
|
||||||
'surcharge_rate': _decimal(
|
'amount': _decimal(detail.CuotaRepercutida),
|
||||||
detail.TipoRecargoEquivalencia),
|
'surcharge_rate': _decimal(
|
||||||
'surcharge_amount': _decimal(
|
detail.TipoRecargoEquivalencia),
|
||||||
detail.CuotaRecargoEquivalencia),
|
'surcharge_amount': _decimal(
|
||||||
})
|
detail.CuotaRecargoEquivalencia),
|
||||||
taxes = SIIReportLineTax.create(taxes_to_create)
|
})
|
||||||
elif sujeta.Exenta:
|
taxes = SIIReportLineTax.create(taxes_to_create)
|
||||||
exemption = sujeta.Exenta.DetalleExenta[0].CausaExencion
|
elif sujeta.Exenta:
|
||||||
for exempt in EXCEMPTION_CAUSE:
|
exemption = sujeta.Exenta.DetalleExenta[0].CausaExencion
|
||||||
if exempt[0] == exemption:
|
for exempt in EXCEMPTION_CAUSE:
|
||||||
exemption = exempt[1]
|
if exempt[0] == exemption:
|
||||||
break
|
exemption = exempt[1]
|
||||||
|
break
|
||||||
|
|
||||||
sii_report_line = {
|
sii_report_line = {
|
||||||
'report': self.id,
|
'report': self.id,
|
||||||
|
@ -843,7 +844,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
|
last_invoice = registers and registers[-1].IDFactura or None
|
||||||
|
|
||||||
# FIXME: the reference is not forced to be unique
|
# FIXME: the reference is not forced to be unique
|
||||||
lines_to_create = []
|
lines_to_create = []
|
||||||
|
|
Loading…
Reference in New Issue