Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
satcfdi committed Mar 15, 2024
1 parent ed17a01 commit 092b1e0
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 18 deletions.
20 changes: 10 additions & 10 deletions satdigitalinvoice/facturacion.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ def set_selected_satcfdis_recibidas(self, cfdis: list):
i = cfdis[0] if len(cfdis) == 1 else None

if i:
estatus = EstadoComprobante(i.estatus)
estatus = i.estatus()
self.window["status_sat_recibidas"].update(
estatus.name.center(10),
disabled=False,
Expand All @@ -508,7 +508,7 @@ def set_selected_satcfdis(self, cfdis: list):
i = cfdis[0] if len(cfdis) == 1 else None

if i:
estatus = EstadoComprobante(i.estatus)
estatus = i.estatus()
self.window["status_sat"].update(
estatus.name.center(10),
disabled=False,
Expand All @@ -523,7 +523,7 @@ def set_selected_satcfdis(self, cfdis: list):
is_active = \
bool(i) \
and i["Emisor"]["Rfc"] in self.emisores \
and i.estatus == EstadoComprobante.VIGENTE
and i.estatus() == EstadoComprobante.VIGENTE
if is_active:
self.window["email_notificada"].update(
"Enviada".center(10) if i.notified() else "Por Enviar",
Expand All @@ -539,7 +539,7 @@ def set_selected_satcfdis(self, cfdis: list):
is_pendientable = \
is_active \
and i["TipoDeComprobante"] == TipoDeComprobante.INGRESO \
and (i["MetodoPago"] == MetodoPago.PAGO_EN_UNA_SOLA_EXHIBICION or i.saldo_pendiente) \
and (i["MetodoPago"] == MetodoPago.PAGO_EN_UNA_SOLA_EXHIBICION or i.saldo_pendiente()) \
and i["Total"]
if is_pendientable:
self.window["pendiente_pago"].update(
Expand All @@ -553,7 +553,7 @@ def set_selected_satcfdis(self, cfdis: list):
is_ppd_pagada = is_active \
and i["TipoDeComprobante"] == TipoDeComprobante.INGRESO \
and i["MetodoPago"] == MetodoPago.PAGO_EN_PARCIALIDADES_O_DIFERIDO \
and i.saldo_pendiente == 0
and i.saldo_pendiente() == 0
if is_ppd_pagada:
self.window["pendiente_pago"].update(
"Pagada".center(10),
Expand All @@ -572,10 +572,10 @@ def set_selected_satcfdis(self, cfdis: list):
is_active \
and i["TipoDeComprobante"] == TipoDeComprobante.INGRESO \
and i["MetodoPago"] == MetodoPago.PAGO_EN_PARCIALIDADES_O_DIFERIDO \
and i.saldo_pendiente > 0
and i.saldo_pendiente() > 0

self.window["ppd_action_items"].update(visible=is_ppd_active)
self.window["importe_pago"].update(i.saldo_pendiente if is_ppd_active else '')
self.window["importe_pago"].update(i.saldo_pendiente() if is_ppd_active else '')
if is_ppd_active:
self.action_button_manager.set_items("pago", [i])
else:
Expand Down Expand Up @@ -612,7 +612,7 @@ def fact_iter():
for i in self.get_all_invoices().values():
if i["Emisor"]["Rfc"] in self.emisores \
and not i.notified() \
and i.estatus == EstadoComprobante.VIGENTE:
and i.estatus() == EstadoComprobante.VIGENTE:
yield i
elif date_search_text := to_date_period(search_text):
for i in self.get_all_invoices().values():
Expand Down Expand Up @@ -662,7 +662,7 @@ def fact_iter():
for i in self.get_all_invoices().values():
if i["Receptor"]["Rfc"] in self.emisores \
and not self.local_db.notified(i) \
and i.estatus == EstadoComprobante.VIGENTE:
and i.estatus() == EstadoComprobante.VIGENTE:
yield i
elif date_search_text := to_date_period(search_text):
for i in self.get_all_invoices().values():
Expand Down Expand Up @@ -858,7 +858,7 @@ def correos():
sorted(
(i for i in self.get_all_invoices().values()
if i["Emisor"]["Rfc"] in self.emisores
and i.estatus == EstadoComprobante.VIGENTE
and i.estatus() == EstadoComprobante.VIGENTE
and not i.notified()
),
key=lambda r: r["Receptor"]["Rfc"]
Expand Down
2 changes: 1 addition & 1 deletion satdigitalinvoice/gui_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def pago_factura(factura_pagar, fecha_pago: datetime, forma_pago: str, importe_p
PagoComprobante(
comprobante=c,
num_parcialidad=c.ultima_num_parcialidad + 1,
imp_saldo_ant=c.saldo_pendiente,
imp_saldo_ant=c.saldo_pendiente(),
imp_pagado=importe_pago
)
],
Expand Down
4 changes: 2 additions & 2 deletions satdigitalinvoice/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def make_layout():
r.name,
r["Fecha"].strftime(CALENDAR_FECHA_FMT),
r["Total"],
r.saldo_pendiente if r.saldo_pendiente else "",
r.saldo_pendiente() or "",
r.liquidated_notified_icons,
mf_pago_fmt(r),
r.uuid
Expand Down Expand Up @@ -288,7 +288,7 @@ def make_layout():
r.name,
r["Fecha"].strftime(CALENDAR_FECHA_FMT),
r["Total"],
r.saldo_pendiente if r.saldo_pendiente else "",
r.saldo_pendiente() or "",
r.liquidated_notified_icons,
mf_pago_fmt(r),
r.uuid
Expand Down
11 changes: 7 additions & 4 deletions satdigitalinvoice/mycfdi.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,12 @@ class MyCFDI(SatCFDI):
enviar_a_partir = None
pagar_a_partir = None

@SatCFDI.estatus.getter
def estatus(self) -> EstadoComprobante:
return self.status_sat().get('Estatus', EstadoComprobante.VIGENTE)
res = self.status_sat().get('Estatus', EstadoComprobante.VIGENTE)
if isinstance(res, EstadoComprobante):
return res
else:
return EstadoComprobante(res)

def status_sat(self, update=False) -> dict:
if update:
Expand Down Expand Up @@ -238,14 +241,14 @@ def liquidated_flip(self):
return v

def liquidated_state(self):
if self.estatus == EstadoComprobante.CANCELADO:
if self.estatus() == EstadoComprobante.CANCELADO:
return LiquidatedState.CANCELLED

if self["TipoDeComprobante"] != TipoDeComprobante.INGRESO:
return LiquidatedState.NONE

mpago = self["MetodoPago"]
if self['Total'] == 0 or (mpago == MetodoPago.PAGO_EN_PARCIALIDADES_O_DIFERIDO and self.saldo_pendiente == 0):
if self['Total'] == 0 or (mpago == MetodoPago.PAGO_EN_PARCIALIDADES_O_DIFERIDO and self.saldo_pendiente() == 0):
return LiquidatedState.PAID

if self.liquidated():
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
],
},
install_requires=[
'satcfdi==4.3.5',
'satcfdi==4.4.0',
'diskcache',
'num2words',
'PyYAML',
Expand Down

0 comments on commit 092b1e0

Please sign in to comment.