From aacb73e1cfca849cb6e06201307aae14e28ae3be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 18 Mar 2026 13:15:43 +0100 Subject: [PATCH] Do not fail on calculating max ID when setting sequence on empty group Since 9fdf4dbd66f2 set_sequence calculates the maximum ID but it may be called with only 0 if the group is empty. Closes #14689 (grafted from 70eee4cb081a58572fe9b3a4890bac387c2d3e53) --HG-- branch : 6.0 --- tryton/tryton/gui/window/view_form/model/group.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/tryton/gui/window/view_form/model/group.py b/tryton/tryton/gui/window/view_form/model/group.py index 3b1a48c260..5446589edb 100644 --- a/tryton/tryton/gui/window/view_form/model/group.py +++ b/tryton/tryton/gui/window/view_form/model/group.py @@ -358,7 +358,7 @@ class Group(SignalEvent, list): cmp = operator.gt else: cmp = operator.lt - max_id = max(0, *(r.id for r in self)) + max_id = max(0, 0, *(r.id for r in self)) for record in self: # Assume not loaded records are correctly ordered # as far as we do not change any previous records.