From be75abeb541b4c971c10fc903da1f5c20a4c57d8 Mon Sep 17 00:00:00 2001 From: Mauricio Baeza Date: Sun, 22 Aug 2021 22:33:04 -0500 Subject: [PATCH] Get wharehouse in products --- source/app/models/main.py | 11 +++++++++++ source/static/js/controller/products.js | 1 + source/static/js/ui/products.js | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/source/app/models/main.py b/source/app/models/main.py index aab1d25..43eccdc 100644 --- a/source/app/models/main.py +++ b/source/app/models/main.py @@ -3402,6 +3402,17 @@ class Almacenes(BaseModel): ) return tuple(rows) + @classmethod + def _get_for_select(cls, values={}): + rows = (Almacenes + .select( + Almacenes.id, + Almacenes.name.alias('value'), + ) + .dicts() + ) + return tuple(rows) + @classmethod def _get_all(cls, values): rows = (Almacenes diff --git a/source/static/js/controller/products.js b/source/static/js/controller/products.js index c654009..3049bc5 100644 --- a/source/static/js/controller/products.js +++ b/source/static/js/controller/products.js @@ -464,6 +464,7 @@ function cmd_add_inventory_click(id, e, node){ $$('txt_add_key').setValue(row.clave) $$('txt_add_unit').setValue(row.unidad) $$('txt_add_description').setValue(row.descripcion) + $$('lst_warehouses').getList().load('/warehouse?opt=for_select') $$('win_add_inventory').show() } diff --git a/source/static/js/ui/products.js b/source/static/js/ui/products.js index 3b150c0..fe8275f 100644 --- a/source/static/js/ui/products.js +++ b/source/static/js/ui/products.js @@ -432,7 +432,7 @@ var body_add_inventory = {rows: [{minHeight: 10}, {view: 'counter', id: 'txt_new_cant', label: 'Cantidad a agregar', labelWidth: 'auto', step: 1, value: 0, min: 0.01}, {view: 'richselect', id: 'lst_warehouses', label: 'Almacen: ', - labelPosition: 'left', required: false, options: [], hidden: true}, + labelPosition: 'left', required: false, options: [], hidden: false}, ]}, {minHeight: 20}, {cols: [{},