Skip to content

Commit

Permalink
Add data operacion recursiu
Browse files Browse the repository at this point in the history
  • Loading branch information
guilleJB committed Oct 9, 2024
1 parent 3b9fa25 commit 7aed3ea
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions sii/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,12 @@ def get_factura_emitida_tipo_desglose(invoice):

return tipo_desglose

def get_fecha_operacion_rec(invoice):
if invoice.rectificative_type == 'N':
return invoice.date_invoice
else:
return get_fecha_operacion_rec(invoice.rectifying_id)


def get_fact_rect_sustitucion_fields(invoice, opcion=False):
"""
Expand Down Expand Up @@ -335,7 +341,7 @@ def get_fact_rect_sustitucion_fields(invoice, opcion=False):
"""
rectificativa_fields = {
'TipoRectificativa': 'S', # Por sustitución
'FechaOperacion': invoice.rectifying_id.date_invoice
'FechaOperacion': get_fecha_operacion_rec(invoice)
}

if opcion == 1:
Expand Down Expand Up @@ -427,7 +433,7 @@ def get_factura_emitida(invoice, rect_sust_opc1=False, rect_sust_opc2=False):
}
if invoice.rectificative_type in ('A', 'B'):
factura_expedida.update(
{'FechaOperacion': invoice.rectifying_id.date_invoice}
{'FechaOperacion': get_fecha_operacion_rec(invoice)}
)
if rectificativa:
opcion = 0
Expand Down

0 comments on commit 7aed3ea

Please sign in to comment.