Fix - Al obtener nueva clave en productos
This commit is contained in:
parent
741d0c506f
commit
af0b2b6c56
|
@ -2126,13 +2126,11 @@ class Productos(BaseModel):
|
|||
@classmethod
|
||||
def next_key(cls):
|
||||
value = (Productos
|
||||
.select(fn.Max(Productos.id).alias('fm'))
|
||||
.select(fn.Max(cast(Productos.clave, 'int')).alias('fm'))
|
||||
.order_by(SQL('fm'))
|
||||
.scalar())
|
||||
if value is None:
|
||||
value = 1
|
||||
else:
|
||||
value += 1
|
||||
value = value or 0
|
||||
value += 1
|
||||
return {'value': value}
|
||||
|
||||
@classmethod
|
||||
|
|
Loading…
Reference in New Issue