Add column 'In branch' for users

This commit is contained in:
Mauricio Baeza 2021-08-03 20:08:57 -05:00
parent 4f18e1e01f
commit 91cfbb0508
3 changed files with 23 additions and 4 deletions

View File

@ -3477,11 +3477,16 @@ class Sucursales(BaseModel):
Sucursales.serie_tickets,
Almacenes.name.alias('warehouse'),
)
.join(Almacenes).switch(Sucursales)
.join(Almacenes, JOIN.LEFT_OUTER).switch(Sucursales)
.dicts()
)
return tuple(rows)
@classmethod
def _get_there_are_branchs(cls, args):
result = bool(Sucursales.select().count())
return result
@classmethod
def get_data(cls, values):
opt = values['opt']
@ -3836,8 +3841,7 @@ class Productos(BaseModel):
Productos.descripcion,
SATUnidades.name.alias('unidad'),
Productos.valor_unitario)
.join(SATUnidades)
.switch(Productos)
.join(SATUnidades).switch(Productos)
.where((Productos.es_activo==True) &
((Productos.descripcion.contains(name)) |
(Productos.clave.contains(name))))

View File

@ -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')
}
}
})
}

View File

@ -1,5 +1,5 @@
//~ 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
//~ it under the terms of the GNU General Public License as published by
@ -1340,6 +1340,8 @@ var grid_usuarios_cols = [
hidden: true},
{id: 'ultimo_ingreso', header: 'Ultimo Ingreso', fillspace: 1,
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()}',
editor: 'checkbox', adjust: 'header'},
{id: 'es_admin', header: 'Es Admin', template: '{common.checkbox()}',