From 2f35a7b9b8a2e69c06e6c072768738ea21c6289d 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 --- purchase.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/purchase.py b/purchase.py index 09504608b3..46e45e77b8 100644 --- a/purchase.py +++ b/purchase.py @@ -5,6 +5,7 @@ from functools import wraps from itertools import groupby from sql.conditionals import Case +from sql.functions import CharLength from trytond.i18n import gettext from trytond.model import ModelSQL, ModelView, Workflow, fields @@ -165,6 +166,11 @@ class Quotation(Workflow, ModelSQL, ModelView): }, }) + @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')