forked from elmau/empresa-libre
Fix - clave siguiente en productos
This commit is contained in:
parent
e690aa3ce9
commit
6184a8c892
|
@ -832,9 +832,8 @@ class Productos(BaseModel):
|
||||||
@classmethod
|
@classmethod
|
||||||
def next_key(cls):
|
def next_key(cls):
|
||||||
value = (Productos
|
value = (Productos
|
||||||
.select(fn.Max(Productos.id))
|
.select(fn.Max(Productos.id).alias('fm'))
|
||||||
.group_by(Productos.id)
|
.order_by(SQL('fm'))
|
||||||
.order_by(Productos.id)
|
|
||||||
.scalar())
|
.scalar())
|
||||||
if value is None:
|
if value is None:
|
||||||
value = 1
|
value = 1
|
||||||
|
|
Loading…
Reference in New Issue