Fix InversionSujetoPasivo on received invoices.

This commit refs #21051
This commit is contained in:
Sergio Morillo 2021-11-29 19:02:28 +01:00
parent 16c369cb3f
commit c92609c7de
1 changed files with 8 additions and 8 deletions

View File

@ -490,16 +490,16 @@ class RecievedInvoiceMapper(BaseInvoiceMapper):
'FechaRegContable': self._move_date(invoice).strftime(_DATE_FMT),
'CuotaDeducible': self._deductible_amount(invoice),
}
tax_section = 'DesgloseIVA'
if (self.not_exempt_kind(invoice)
and self.not_exempt_kind(invoice) == 'S2'):
tax_section = 'InversionSujetoPasivo'
ret['DesgloseFactura'][tax_section] = {'DetalleIVA': []}
_taxes = self.taxes(invoice)
if _taxes:
ret['DesgloseFactura'][tax_section]['DetalleIVA'].extend(
self.build_taxes(invoice, tax) for tax in _taxes)
for tax in _taxes:
tax_section = 'DesgloseIVA'
if (self.not_exempt_kind(tax.tax)
and self.not_exempt_kind(tax.tax) == 'S2'):
tax_section = 'InversionSujetoPasivo'
ret['DesgloseFactura'].setdefault(tax_section, {'DetalleIVA': []})
ret['DesgloseFactura'][tax_section]['DetalleIVA'].append(
self.build_taxes(invoice, tax))
self._update_rectified_invoice(ret, invoice)
return ret