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
(grafted from ceb83d197bfcced51643cb723590cd97127eda86)

--HG--
branch : 6.0
This commit is contained in:
Cédric Krier
2024-12-21 18:12:09 +01:00
parent 6ae4ae429e
commit 0b2fb7baca
@@ -1032,6 +1032,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):