From bff6733ca7b7cb8ff1102e1691c2a44a8af2fc23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 11 Jun 2024 09:29:57 +0200 Subject: [PATCH] Set focus on search entry after search Closes #13328 --- sao/CHANGELOG | 1 + sao/src/screen.js | 1 + sao/src/window.js | 3 +++ tryton/CHANGELOG | 1 + tryton/tryton/gui/window/view_form/screen/screen.py | 1 + tryton/tryton/gui/window/view_form/view/list.py | 2 +- 6 files changed, 8 insertions(+), 1 deletion(-) diff --git a/sao/CHANGELOG b/sao/CHANGELOG index 3661b0dbf2..8682738ee1 100644 --- a/sao/CHANGELOG +++ b/sao/CHANGELOG @@ -1,3 +1,4 @@ +* Set focus on search entry after search * Support language suffix in CSV export * Close tab with mouse middle click * Support language suffix in CSV import diff --git a/sao/src/screen.js b/sao/src/screen.js index e6e230a8ef..48e612faff 100644 --- a/sao/src/screen.js +++ b/sao/src/screen.js @@ -1097,6 +1097,7 @@ return ids; } this.clear(); + this.screen_container.search_entry.focus(); return this.load(ids).then(() => { this.count_tab_domain(); }); diff --git a/sao/src/window.js b/sao/src/window.js index d7b33e6603..c59cb7ed8c 100644 --- a/sao/src/window.js +++ b/sao/src/window.js @@ -984,6 +984,9 @@ } }); }); + this.el.on('shown.bs.modal', () => { + this.screen.screen_container.search_entry.focus(); + }); this.el.on('hidden.bs.modal', function(event) { jQuery(this).remove(); }); diff --git a/tryton/CHANGELOG b/tryton/CHANGELOG index 3c381d384d..bf38832d9b 100644 --- a/tryton/CHANGELOG +++ b/tryton/CHANGELOG @@ -1,3 +1,4 @@ +* Set focus on search entry after search * Support language suffix in CSV export * Close tab with mouse middle click * Support language suffix in CSV import diff --git a/tryton/tryton/gui/window/view_form/screen/screen.py b/tryton/tryton/gui/window/view_form/screen/screen.py index cbbe65fd1b..11e08ac30f 100644 --- a/tryton/tryton/gui/window/view_form/screen/screen.py +++ b/tryton/tryton/gui/window/view_form/screen/screen.py @@ -323,6 +323,7 @@ class Screen: if only_ids: return ids self.clear() + GLib.idle_add(self.screen_container.search_entry.grab_focus) self.load(ids) self.count_tab_domain() return bool(ids) diff --git a/tryton/tryton/gui/window/view_form/view/list.py b/tryton/tryton/gui/window/view_form/view/list.py index ad47dbb2c5..01e51b0dbf 100644 --- a/tryton/tryton/gui/window/view_form/view/list.py +++ b/tryton/tryton/gui/window/view_form/view/list.py @@ -1220,9 +1220,9 @@ class ViewTree(View): label.set_text(text) def set_cursor(self, new=False, reset_view=True): - self.treeview.grab_focus() model = self.treeview.get_model() if self.record and model and self.treeview.get_realized(): + self.treeview.grab_focus() path = self.record.get_index_path(model.group) if model.get_flags() & Gtk.TreeModelFlags.LIST_ONLY: path = (path[0],)