Only admins can add inventory
This commit is contained in:
parent
637c69b9c7
commit
227204abec
|
@ -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.'
|
||||
|
|
Loading…
Reference in New Issue