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