Skip to content

Commit 22da43c

Browse files
authored
Merge pull request #150 from gisce/imp_send_export_e2_with_base
Marcar en una exportación E2 como NoSujetaIva y con la base BaseImponible
2 parents ca434e4 + 45f3b82 commit 22da43c

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

sii/resource.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ def get_iva_values(invoice, in_invoice, is_export=False, is_import=False):
9292
continue
9393
else:
9494
vals['sujeta_a_iva'] = True
95+
if is_export:
96+
vals['sujeta_a_iva'] = False
97+
vals['detalle_iva_exento']['BaseImponible'] += base_imponible
9598
invoice_total -= (base_imponible + cuota)
9699

97100
tax_type = inv_tax.tax_id.type
@@ -109,7 +112,7 @@ def get_iva_values(invoice, in_invoice, is_export=False, is_import=False):
109112
# detectan como IVA exento
110113
elif not is_export and not is_import and is_iva_exento:
111114
vals['iva_exento'] = True
112-
vals['detalle_iva_exento']['BaseImponible'] += inv_tax.base
115+
vals['detalle_iva_exento']['BaseImponible'] += base_imponible
113116
else:
114117
if in_invoice:
115118
cuota_key = 'CuotaSoportada'

spec/serialization_spec.py

+14-16
Original file line numberDiff line numberDiff line change
@@ -345,30 +345,28 @@ def group_by_tax_rate(iva_values, in_invoice):
345345
detalle_iva = (
346346
self.factura_emitida['FacturaExpedida']['TipoDesglose']
347347
['DesgloseTipoOperacion']['Entrega']['Sujeta']
348-
['NoExenta']['DesgloseIVA']['DetalleIVA']
349-
)
350-
self.grouped_detalle_iva = group_by_tax_rate(
351-
detalle_iva, in_invoice=False
348+
['Exenta']['DetalleExenta']
352349
)
350+
self.detalle_iva = detalle_iva
353351

354352
with it('la BaseImponible debe ser la original'):
353+
total_base = sum([x.base for x in self.out_invoice.tax_line if 'IVA' in x.name])
355354
expect(
356-
self.grouped_detalle_iva[21.0]['BaseImponible']
355+
self.detalle_iva['BaseImponible']
357356
).to(equal(
358-
self.out_invoice.tax_line[0].base
357+
total_base
359358
))
360-
with it('la CuotaRepercutida debe ser la original'):
359+
with it('la Causa Exención tiene que ser E2'):
361360
expect(
362-
self.grouped_detalle_iva[21.0]['CuotaRepercutida']
363-
).to(equal(
364-
self.out_invoice.tax_line[0].tax_amount
365-
))
366-
with it('el TipoImpositivo debe ser la original'):
361+
self.detalle_iva['CausaExencion']
362+
).to(equal('E2'))
363+
with it('No lleva ni tipo impositivo ni Cuota'):
367364
expect(
368-
self.grouped_detalle_iva[21.0]['TipoImpositivo']
369-
).to(equal(
370-
self.out_invoice.tax_line[0].tax_id.amount * 100
371-
))
365+
self.detalle_iva.get('TipoImpositivo','NOTEXIST')
366+
).to(equal('NOTEXIST'))
367+
expect(
368+
self.detalle_iva.get('CuotaRepercutida','NOTEXIST')
369+
).to(equal('NOTEXIST'))
372370

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

0 commit comments

Comments
 (0)