Add validate for cancel movement bank
This commit is contained in:
parent
dd7b9c1680
commit
4dc54ade1e
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue