From 5229eaf4dcef4b0fc2c6d44c082a31fd814c14d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 21 Dec 2024 18:12:09 +0100 Subject: [PATCH] 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 --- tryton/tryton/gui/window/view_form/view/list.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tryton/tryton/gui/window/view_form/view/list.py b/tryton/tryton/gui/window/view_form/view/list.py index fc3c4cf9f1..f94c5a9fa7 100644 --- a/tryton/tryton/gui/window/view_form/view/list.py +++ b/tryton/tryton/gui/window/view_form/view/list.py @@ -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):