diff --git a/source/app/models/main.py b/source/app/models/main.py index 42d883c..2e78e77 100644 --- a/source/app/models/main.py +++ b/source/app/models/main.py @@ -443,7 +443,8 @@ class Configuracion(BaseModel): 'chk_config_codigo_barras', 'chk_config_precio_con_impuestos', 'chk_llevar_inventario', - 'chk_use_packing', + 'chk_multi_stock', + # ~ 'chk_use_packing', ) data = (Configuracion .select() diff --git a/source/static/js/controller/admin.js b/source/static/js/controller/admin.js index 2dbab6e..f22aa1e 100644 --- a/source/static/js/controller/admin.js +++ b/source/static/js/controller/admin.js @@ -95,7 +95,8 @@ var controllers = { $$('chk_config_codigo_barras').attachEvent('onItemClick', chk_config_item_click) $$('chk_config_precio_con_impuestos').attachEvent('onItemClick', chk_config_item_click) $$('chk_llevar_inventario').attachEvent('onItemClick', chk_config_item_click) - $$('chk_use_packing').attachEvent('onItemClick', chk_config_item_click) + $$('chk_multi_stock').attachEvent('onItemClick', chk_config_item_click) + //~ $$('chk_use_packing').attachEvent('onItemClick', chk_config_item_click) //~ Complements $$('chk_usar_nomina').attachEvent('onItemClick', chk_config_item_click) @@ -518,6 +519,10 @@ function get_config_values(opt){ $$(key).setValue(values[key]) if(key=='chk_config_leyendas_fiscales'){ admin_config_other_options(key) + }else if(key=='chk_multi_stock'){ + if($$(key).getValue()){ + $$('chk_multi_stock').enable() + } } } }) @@ -2494,13 +2499,21 @@ function opt_make_pdf_from_on_change(new_value, old_value){ function admin_config_other_options(id){ + var value = Boolean($$(id).getValue()) if(id=='chk_config_leyendas_fiscales'){ - var value = Boolean($$(id).getValue()) if(value){ $$('cmd_admin_leyendas_fiscales').enable() }else{ $$('cmd_admin_leyendas_fiscales').disable() } + }else if(id=='chk_llevar_inventario'){ + if(value){ + $$('chk_multi_stock').enable() + }else{ + $$('chk_multi_stock').setValue(0) + $$('chk_multi_stock').disable() + disable_config_option('chk_multi_stock') + } } } @@ -2910,3 +2923,21 @@ function grid_sucursales_click(id, e, node){ }) } + +function disable_config_option(id){ + var values = {} + values[id] = 0 + + webix.ajax().sync().post('/config', values, { + error: function(text, data, xhr) { + msg = 'Error al guardar la configuraciĆ³n' + msg_error(msg) + }, + success: function(text, data, xhr) { + var values = data.json(); + if (!values.ok){ + msg_error(values.msg) + } + } + }) +} diff --git a/source/static/js/ui/admin.js b/source/static/js/ui/admin.js index a238608..89a8b10 100644 --- a/source/static/js/ui/admin.js +++ b/source/static/js/ui/admin.js @@ -772,8 +772,10 @@ var options_admin_products = [ labelRight: 'Mostrar precio con impuestos'}]}, {cols: [{view: 'checkbox', id: 'chk_llevar_inventario', labelWidth: 15, labelRight: 'Mostrar inventario'}]}, - {cols: [{view: 'checkbox', id: 'chk_use_packing', labelWidth: 15, - labelRight: 'Usar empaques'}]}, + {cols: [{maxWidth: 30}, {view: 'checkbox', id: 'chk_multi_stock', labelWidth: 15, + labelRight: 'Multialmacen', disabled: true}]}, + //~ {cols: [{view: 'checkbox', id: 'chk_use_packing', labelWidth: 15, + //~ labelRight: 'Usar empaques', hidden: true}]}, ]