Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marcar en una exportación E2 como NoSujetaIva y con la base BaseImponible #150

Merged
merged 8 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion sii/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ def get_iva_values(invoice, in_invoice, is_export=False, is_import=False):
continue
else:
vals['sujeta_a_iva'] = True
if is_export:
vals['sujeta_a_iva'] = False
vals['detalle_iva_exento']['BaseImponible'] += base_imponible
invoice_total -= (base_imponible + cuota)

tax_type = inv_tax.tax_id.type
Expand All @@ -109,7 +112,7 @@ def get_iva_values(invoice, in_invoice, is_export=False, is_import=False):
# detectan como IVA exento
elif not is_export and not is_import and is_iva_exento:
vals['iva_exento'] = True
vals['detalle_iva_exento']['BaseImponible'] += inv_tax.base
vals['detalle_iva_exento']['BaseImponible'] += base_imponible
else:
if in_invoice:
cuota_key = 'CuotaSoportada'
Expand Down
30 changes: 14 additions & 16 deletions spec/serialization_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,30 +345,28 @@ def group_by_tax_rate(iva_values, in_invoice):
detalle_iva = (
self.factura_emitida['FacturaExpedida']['TipoDesglose']
['DesgloseTipoOperacion']['Entrega']['Sujeta']
['NoExenta']['DesgloseIVA']['DetalleIVA']
)
self.grouped_detalle_iva = group_by_tax_rate(
detalle_iva, in_invoice=False
['Exenta']['DetalleExenta']
)
self.detalle_iva = detalle_iva

with it('la BaseImponible debe ser la original'):
total_base = sum([x.base for x in self.out_invoice.tax_line if 'IVA' in x.name])
expect(
self.grouped_detalle_iva[21.0]['BaseImponible']
self.detalle_iva['BaseImponible']
).to(equal(
self.out_invoice.tax_line[0].base
total_base
))
with it('la CuotaRepercutida debe ser la original'):
with it('la Causa Exención tiene que ser E2'):
expect(
self.grouped_detalle_iva[21.0]['CuotaRepercutida']
).to(equal(
self.out_invoice.tax_line[0].tax_amount
))
with it('el TipoImpositivo debe ser la original'):
self.detalle_iva['CausaExencion']
).to(equal('E2'))
with it('No lleva ni tipo impositivo ni Cuota'):
expect(
self.grouped_detalle_iva[21.0]['TipoImpositivo']
).to(equal(
self.out_invoice.tax_line[0].tax_id.amount * 100
))
self.detalle_iva.get('TipoImpositivo','NOTEXIST')
).to(equal('NOTEXIST'))
expect(
self.detalle_iva.get('CuotaRepercutida','NOTEXIST')
).to(equal('NOTEXIST'))

with context('si es una operación de alquiler (CRE "12" o "13")'):
with before.all:
Expand Down
Loading