details:   https://code.tryton.org/tryton/commit/fec6344ae3f6
branch:    7.0
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
        (grafted from 70eee4cb081a58572fe9b3a4890bac387c2d3e53)
diffstat:

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

diffs (12 lines):

diff -r 9f034635bfeb -r fec6344ae3f6 
tryton/tryton/gui/window/view_form/model/group.py
--- a/tryton/tryton/gui/window/view_form/model/group.py Mon Mar 16 10:30:54 
2026 +0100
+++ b/tryton/tryton/gui/window/view_form/model/group.py Wed Mar 18 13:15:43 
2026 +0100
@@ -342,7 +342,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