From 764824c987e2cd55d271654be694a14b2491a805 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=C3=89vrard?= Date: Sat, 17 Sep 2022 18:58:55 +0200 Subject: [PATCH] Select the clicked line when activating a button in list view issue11212 review433141003 --- tryton/gui/window/view_form/view/list_gtk/widget.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tryton/gui/window/view_form/view/list_gtk/widget.py b/tryton/gui/window/view_form/view/list_gtk/widget.py index 74f9899b2..ae46c1625 100644 --- a/tryton/gui/window/view_form/view/list_gtk/widget.py +++ b/tryton/gui/window/view_form/view/list_gtk/widget.py @@ -1305,11 +1305,17 @@ def button_clicked(self, widget, path): store = self.view.treeview.get_model() record = store.get_value(store.get_iter(path), 0) + if self.view.record and self.view.record != record: + widget.stop_emission_by_name('clicked') + return True + state_changes = record.expr_eval( self.attrs.get('states', {})) if state_changes.get('invisible') \ or state_changes.get('readonly'): return True + + self.view.treeview.set_cursor(path) widget.handler_block_by_func(self.button_clicked) try: self.view.screen.button(self.attrs)