Skip to content

Commit

Permalink
Merge pull request #150 from gisce/imp_send_export_e2_with_base
Browse files Browse the repository at this point in the history
Marcar en una exportación E2 como NoSujetaIva y con la base BaseImponible
  • Loading branch information
guilleJB authored Jul 1, 2024
2 parents ca434e4 + 45f3b82 commit 22da43c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
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

0 comments on commit 22da43c

Please sign in to comment.