diff --git a/source/app/models/main.py b/source/app/models/main.py index 353e400..cb2116b 100644 --- a/source/app/models/main.py +++ b/source/app/models/main.py @@ -9471,7 +9471,6 @@ class InventoryEntries(BaseModel): return obj, msg - # ~ teresa def _get_or_create_product(self, args, cant): # ~ almacen = ForeignKeyField(Almacenes, null=True) id = int(args.get('id_product', '0')) @@ -9503,7 +9502,6 @@ class InventoryEntries(BaseModel): return obj - def _add_entries(self, products, partner): msg = '' @@ -9526,6 +9524,10 @@ class InventoryEntries(BaseModel): def _create(self, args, user): # ~ print('ARGS', args) + if not user.es_admin: + msg = 'Solo un administrador puede usar esta función.' + result = {'ok': False, 'msg': msg} + return result partner, error = self._get_or_create_partner(self, args['partner']) if error: @@ -9543,6 +9545,11 @@ class InventoryEntries(BaseModel): return result def _create_manual(self, args, user): + if not user.es_admin: + msg = 'Solo un administrador puede usar esta función.' + result = {'ok': False, 'msg': msg} + return result + product = Productos.get(Productos.id==args['product_id']) if not product.inventario: msg = 'Este producto no lleva inventario.'