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
This commit is contained in:
Cédric Krier
2026-03-18 13:15:43 +01:00
parent 07191e9ea3
commit aacb73e1cf
@@ -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.