Do not select current record if it is no more in the group

on_change calls may remove the current record without updating the screen such
that it is not possible to compute a selection path.

Closes #13770
This commit is contained in:
Cédric Krier committed 2024-12-21 18:12:09 +01:00
1 parent 2c0f7be02d
commit 5229eaf4dc
1 file changed
+4
@@ -1139,6 +1139,10 @@ class ViewTree(View):
def display(self, force=False):
self.treeview.display_counter += 1
current_record = self.record
if current_record and current_record not in current_record.group:
# current record may have been removed by on_change calls without
# changing the current record of screen before the display
current_record = None
if (force
or not self.treeview.get_model()
or self.group != self.treeview.get_model().group):