diff --git a/tryton/tryton/gui/window/view_form/view/list_form.py b/tryton/tryton/gui/window/view_form/view/list_form.py index ba01dee6f88..52a6dbd3eff 100644 --- a/tryton/tryton/gui/window/view_form/view/list_form.py +++ b/tryton/tryton/gui/window/view_form/view/list_form.py @@ -154,15 +154,17 @@ def select_nodes(self, nodes): if not nodes: return nodes = {n[0] for n in nodes} - self.listbox.handler_block_by_func(self.select_nodes) - self.listbox.unselect_all() - for idx, view_form in enumerate(self._view_forms): - if view_form.record.id in nodes: - row = self.listbox.get_row_at_index(idx) - if not row: - continue - self.listbox.select_row(row) - self.listbox.handler_unblock_by_func(self.select_nodes) + self.listbox.handler_block_by_func(self._row_selected) + try: + self.listbox.unselect_all() + for idx, view_form in enumerate(self._view_forms): + if view_form.record.id in nodes: + row = self.listbox.get_row_at_index(idx) + if not row: + continue + self.listbox.select_row(row) + finally: + self.listbox.handler_unblock_by_func(self._row_selected) def _row_selected(self, listbox, row): previous_record = self.record @@ -205,11 +207,11 @@ def _select_show_row(self, index): return # unselect_all triggers a loop in _row_selected if the record is not # valid - self.listbox.handler_block_by_func(self._select_show_row) + self.listbox.handler_block_by_func(self._row_selected) try: self.listbox.unselect_all() finally: - self.listbox.handler_unblock_by_func(self._select_show_row) + self.listbox.handler_unblock_by_func(self._row_selected) row = self.listbox.get_row_at_index(index) if not row or not row.get_realized(): return