forked from elmau/empresa-libre
Add column 'In branch' for users
This commit is contained in:
parent
4f18e1e01f
commit
91cfbb0508
|
@ -3477,11 +3477,16 @@ class Sucursales(BaseModel):
|
||||||
Sucursales.serie_tickets,
|
Sucursales.serie_tickets,
|
||||||
Almacenes.name.alias('warehouse'),
|
Almacenes.name.alias('warehouse'),
|
||||||
)
|
)
|
||||||
.join(Almacenes).switch(Sucursales)
|
.join(Almacenes, JOIN.LEFT_OUTER).switch(Sucursales)
|
||||||
.dicts()
|
.dicts()
|
||||||
)
|
)
|
||||||
return tuple(rows)
|
return tuple(rows)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def _get_there_are_branchs(cls, args):
|
||||||
|
result = bool(Sucursales.select().count())
|
||||||
|
return result
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_data(cls, values):
|
def get_data(cls, values):
|
||||||
opt = values['opt']
|
opt = values['opt']
|
||||||
|
@ -3836,8 +3841,7 @@ class Productos(BaseModel):
|
||||||
Productos.descripcion,
|
Productos.descripcion,
|
||||||
SATUnidades.name.alias('unidad'),
|
SATUnidades.name.alias('unidad'),
|
||||||
Productos.valor_unitario)
|
Productos.valor_unitario)
|
||||||
.join(SATUnidades)
|
.join(SATUnidades).switch(Productos)
|
||||||
.switch(Productos)
|
|
||||||
.where((Productos.es_activo==True) &
|
.where((Productos.es_activo==True) &
|
||||||
((Productos.descripcion.contains(name)) |
|
((Productos.descripcion.contains(name)) |
|
||||||
(Productos.clave.contains(name))))
|
(Productos.clave.contains(name))))
|
||||||
|
|
|
@ -471,6 +471,19 @@ function get_admin_usuarios(){
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
webix.ajax().get('/sucursales', {'opt': 'there_are_branchs'}, {
|
||||||
|
error: function(text, data, xhr) {
|
||||||
|
msg = 'Error al consultar'
|
||||||
|
msg_error(msg)
|
||||||
|
},
|
||||||
|
success: function(text, data, xhr) {
|
||||||
|
var value = data.json()
|
||||||
|
if(value){
|
||||||
|
$$('grid_usuarios').showColumn('in_branch')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//~ Empresa Libre
|
//~ Empresa Libre
|
||||||
//~ Copyright (C) 2016-2018 Mauricio Baeza Servin (web@correolibre.net)
|
//~ Copyright (C) 2016-2021 Mauricio Baeza Servin (public@correolibre.net)
|
||||||
//~
|
//~
|
||||||
//~ This program is free software: you can redistribute it and/or modify
|
//~ This program is free software: you can redistribute it and/or modify
|
||||||
//~ it under the terms of the GNU General Public License as published by
|
//~ it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1340,6 +1340,8 @@ var grid_usuarios_cols = [
|
||||||
hidden: true},
|
hidden: true},
|
||||||
{id: 'ultimo_ingreso', header: 'Ultimo Ingreso', fillspace: 1,
|
{id: 'ultimo_ingreso', header: 'Ultimo Ingreso', fillspace: 1,
|
||||||
hidden: true},
|
hidden: true},
|
||||||
|
{id: 'in_branch', header: 'En Sucursal', template: '{common.checkbox()}',
|
||||||
|
editor: 'checkbox', adjust: 'header', hidden: true},
|
||||||
{id: 'es_activo', header: 'Activo', template: '{common.checkbox()}',
|
{id: 'es_activo', header: 'Activo', template: '{common.checkbox()}',
|
||||||
editor: 'checkbox', adjust: 'header'},
|
editor: 'checkbox', adjust: 'header'},
|
||||||
{id: 'es_admin', header: 'Es Admin', template: '{common.checkbox()}',
|
{id: 'es_admin', header: 'Es Admin', template: '{common.checkbox()}',
|
||||||
|
|
Loading…
Reference in New Issue