details:   https://code.tryton.org/tryton/commit/70eee4cb081a
branch:    default
user:      Cédric Krier <[email protected]>
date:      Wed Mar 18 13:15:43 2026 +0100
description:
        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
diffstat:

 tryton/tryton/gui/window/view_form/model/group.py |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r ae5a633152d6 -r 70eee4cb081a 
tryton/tryton/gui/window/view_form/model/group.py
--- a/tryton/tryton/gui/window/view_form/model/group.py Tue Mar 17 15:18:34 
2026 +0100
+++ b/tryton/tryton/gui/window/view_form/model/group.py Wed Mar 18 13:15:43 
2026 +0100
@@ -345,7 +345,7 @@
             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.

Reply via email to