Use section InversionSujetoPasivo on received invoices if not_exempt_king equal to S2.

This commit is contained in:
José Miguel Pardo Salar 2021-10-25 10:23:48 +02:00
parent c8e053d997
commit de358a1826
1 changed files with 8 additions and 10 deletions

View File

@ -485,22 +485,20 @@ class RecievedInvoiceMapper(BaseInvoiceMapper):
'ImporteTotal': self.total_amount(invoice),
# TODO: BaseImponibleACoste
'DescripcionOperacion': self._description(invoice),
'DesgloseFactura': {
# 'InversionSujetoPasivo': {
# 'DetalleIVA':
# map(self.build_taxes, self.taxes(invoice)),
# },
'DesgloseIVA': {
'DetalleIVA': [],
}
},
'DesgloseFactura': {},
'Contraparte': self._build_counterpart(invoice),
'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']['DesgloseIVA']['DetalleIVA'].extend(
ret['DesgloseFactura'][tax_section]['DetalleIVA'].extend(
self.build_taxes(invoice, tax) for tax in _taxes)
self._update_rectified_invoice(ret, invoice)