Order first by length field filled by sequence

issue11638
review437311003
This commit is contained in:
Cédric Krier committed 2022-09-14 19:27:28 +02:00
1 parent 7677de56d8
commit d75a6c9b16
1 file changed
+6
+6
View File
@@ -3,6 +3,7 @@
from email.header import Header
from sql import Null
from sql.functions import CharLength
from sql.operators import Equal
from trytond.config import config
@@ -97,6 +98,11 @@ class GiftCard(ModelSQL, ModelView):
]
cls._order.insert(0, ('number', 'ASC'))
@classmethod
def order_number(cls, tables):
table, _ = tables[None]
return [CharLength(table.number), table.number]
@classmethod
def default_company(cls):
return Transaction().context.get('company')