From ebd9cf22f825fbb88450fef78498d1ca3c37a37d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 14 Sep 2022 19:27:28 +0200 Subject: [PATCH] Order first by length field filled by sequence issue11638 review437311003 --- account.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/account.py b/account.py index a3fe3567e3..c2ad07fc1c 100644 --- a/account.py +++ b/account.py @@ -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')