forked from elmau/empresa-libre
Nómina - Borrar en lote
This commit is contained in:
parent
f9f80a52e7
commit
f28ab95b50
|
@ -6398,11 +6398,13 @@ class CfdiNomina(BaseModel):
|
||||||
return cls._stamp(cls)
|
return cls._stamp(cls)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def remove(cls, id):
|
def remove(cls, ids):
|
||||||
|
ids = util.loads(ids)
|
||||||
|
for id in ids:
|
||||||
obj = CfdiNomina.get(CfdiNomina.id==id)
|
obj = CfdiNomina.get(CfdiNomina.id==id)
|
||||||
if obj.uuid:
|
if obj.uuid:
|
||||||
return False
|
continue
|
||||||
|
with database_proxy.transaction():
|
||||||
q = CfdiNominaDetalle.delete().where(CfdiNominaDetalle.cfdi==obj)
|
q = CfdiNominaDetalle.delete().where(CfdiNominaDetalle.cfdi==obj)
|
||||||
q.execute()
|
q.execute()
|
||||||
q = CfdiNominaTotales.delete().where(CfdiNominaTotales.cfdi==obj)
|
q = CfdiNominaTotales.delete().where(CfdiNominaTotales.cfdi==obj)
|
||||||
|
@ -6417,8 +6419,9 @@ class CfdiNomina(BaseModel):
|
||||||
q.execute()
|
q.execute()
|
||||||
q = CfdiNominaIncapacidad.delete().where(CfdiNominaIncapacidad.cfdi==obj)
|
q = CfdiNominaIncapacidad.delete().where(CfdiNominaIncapacidad.cfdi==obj)
|
||||||
q.execute()
|
q.execute()
|
||||||
|
obj.delete_instance()
|
||||||
|
|
||||||
return bool(obj.delete_instance())
|
return True
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_xml(cls, id):
|
def get_xml(cls, id):
|
||||||
|
|
|
@ -296,17 +296,25 @@ function cmd_nomina_without_stamp_click(){
|
||||||
|
|
||||||
|
|
||||||
function cmd_nomina_delete_click(){
|
function cmd_nomina_delete_click(){
|
||||||
var row = $$('grid_nomina').getSelectedItem()
|
var rows = $$('grid_nomina').getSelectedItem()
|
||||||
|
|
||||||
if (row == undefined){
|
if (rows == undefined){
|
||||||
msg = 'Selecciona un registro'
|
msg = 'Selecciona al menos un registro'
|
||||||
msg_error(msg)
|
msg_error(msg)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
var ids = []
|
||||||
|
if(Array.isArray(rows)){
|
||||||
|
for(var i in rows){
|
||||||
|
ids.push(rows[i].id)
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
ids.push(rows.id)
|
||||||
|
}
|
||||||
|
|
||||||
msg = '¿Estás seguro de eliminar el registro?<BR><BR>'
|
msg = '¿Estás seguro de eliminar los recibos seleccionado?<BR><BR>'
|
||||||
msg += row['empleado'] + ' (' + row['fecha_pago'] + ')'
|
msg += 'ESTA ACCIÓN NO SE PUEDE DESHACER<BR><BR>'
|
||||||
msg += '<BR><BR>ESTA ACCIÓN NO SE PUEDE DESHACER<BR><BR>'
|
msg += 'Solo se eliminan recibos no timbrados'
|
||||||
webix.confirm({
|
webix.confirm({
|
||||||
title: 'Eliminar Nomina',
|
title: 'Eliminar Nomina',
|
||||||
ok: 'Si',
|
ok: 'Si',
|
||||||
|
@ -315,18 +323,18 @@ function cmd_nomina_delete_click(){
|
||||||
text: msg,
|
text: msg,
|
||||||
callback:function(result){
|
callback:function(result){
|
||||||
if (result){
|
if (result){
|
||||||
delete_nomina(row['id'])
|
delete_nomina(ids)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function delete_nomina(id){
|
function delete_nomina(ids){
|
||||||
webix.ajax().del('/nomina', {id: id}, function(text, xml, xhr){
|
webix.ajax().del('/nomina', {id: ids}, function(text, xml, xhr){
|
||||||
var msg = 'Registro eliminado correctamente'
|
var msg = 'Registros eliminados correctamente'
|
||||||
if (xhr.status == 200){
|
if (xhr.status == 200){
|
||||||
$$('grid_nomina').remove(id);
|
get_nomina()
|
||||||
msg_ok(msg)
|
msg_ok(msg)
|
||||||
} else {
|
} else {
|
||||||
msg = 'No se pudo eliminar.'
|
msg = 'No se pudo eliminar.'
|
||||||
|
|
Loading…
Reference in New Issue