Fix - Issue #129

This commit is contained in:
Mauricio Baeza 2018-01-17 23:29:30 -06:00
parent cc10de702b
commit 4fc525246a
1 changed files with 8 additions and 6 deletions

View File

@ -2146,7 +2146,8 @@ class Productos(BaseModel):
Productos.valor_unitario,
Productos.descuento)
.join(SATUnidades).switch(Productos)
.where((Productos.clave==clave) | (Productos.codigo_barras==clave))
.where((Productos.es_activo==True) &
((Productos.clave==clave) | (Productos.codigo_barras==clave)))
.dicts()
)
if len(row):
@ -2175,7 +2176,8 @@ class Productos(BaseModel):
Productos.valor_unitario,
Productos.descuento)
.join(SATUnidades).switch(Productos)
.where((Productos.id==clave) | (Productos.clave==clave))
.where((Productos.es_activo==True) &
((Productos.id==clave) | (Productos.clave==clave)))
.dicts())
if len(row):
id = row[0]['id']
@ -2187,10 +2189,10 @@ class Productos(BaseModel):
.where(model_pt.productos_id==id).dicts())
return {'ok': True, 'row': row[0], 'taxes': taxes}
return {'ok': False}
name = values.get('name', '')
print (name)
if name:
rows = (Productos
.select(
@ -2202,9 +2204,9 @@ class Productos(BaseModel):
Productos.valor_unitario)
.join(SATUnidades)
.switch(Productos)
.where(
(Productos.descripcion.contains(name)) |
(Productos.clave.contains(name)))
.where((Productos.es_activo==True) &
((Productos.descripcion.contains(name)) |
(Productos.clave.contains(name))))
.dicts()
)
return tuple(rows)