Add validate for cancel movement bank

This commit is contained in:
el Mau 2023-03-06 16:09:37 -06:00
parent dd7b9c1680
commit 4dc54ade1e
3 changed files with 22 additions and 5 deletions

View File

@ -742,7 +742,10 @@ class LIBO(object):
if pakings:
col8.append((pakings[i],))
self._total_cantidades += float(cantidad)
if not count:
cell_5.CellStyle = self._get_style(cell_5)
cell_6.CellStyle = self._get_style(cell_6)
return
style_5 = self._get_style(cell_5)

View File

@ -3384,11 +3384,25 @@ class MovimientosBanco(BaseModel):
msg = 'El movimiento esta conciliado, no se puede cancelar'
return {'ok': False, 'msg': msg}
# ~ filters = (CfdiPagos.movimiento==obj)
# ~ cp = CfdiPagos.select().where(filters).count()
# ~ if cp > 0:
# ~ msg = 'El movimiento tiene Factura de Pago, no se puede cancelar'
# ~ return {'ok': False, 'msg': msg}
filters = (
(CfdiPagos.movimiento==obj) &
(CfdiPagos.uuid.is_null(False)) &
(CfdiPagos.cancelada==False)
)
cp = CfdiPagos.select().where(filters).count()
if cp > 0:
msg = 'El movimiento tiene Factura de Pago activas, no se puede cancelar'
return {'ok': False, 'msg': msg}
filters = (
(CfdiPagos.movimiento==obj) &
(CfdiPagos.uuid.is_null(True)) &
(CfdiPagos.error!='')
)
cp = CfdiPagos.select().where(filters).count()
if cp > 0:
msg = 'El movimiento tiene Factura de Pago con error, no se puede cancelar'
return {'ok': False, 'msg': msg}
with database_proxy.transaction():
obj.cancelado = True