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 865dbb44d7
commit ebd9cf22f8
1 file changed
+7
+7
View File
@@ -4,6 +4,8 @@ from decimal import ROUND_DOWN, ROUND_HALF_EVEN, Decimal
from itertools import groupby
from operator import itemgetter
from sql.functions import CharLength
from trytond import backend
from trytond.i18n import gettext
from trytond.model import MatchMixin, ModelSQL, ModelView, Workflow, fields
@@ -197,6 +199,11 @@ class LandedCost(Workflow, ModelSQL, ModelView, MatchMixin):
[sql_table.state], ['cancelled'],
where=sql_table.state == 'cancel'))
@classmethod
def order_number(cls, tables):
table, _ = tables[None]
return [CharLength(table.number), table.number]
@staticmethod
def default_company():
return Transaction().context.get('company')