From 5a4482fa85243c9b4e664c63a7f58927bbef5b70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 11 Jun 2018 23:24:18 +0200 Subject: [PATCH] Don't show WinSearch on Many2Many if it has a single result If the search result is a single record, we add it directly instead of showing the pop-up. issue7476 review45591002 --- tryton/gui/window/view_form/view/form_gtk/many2many.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tryton/gui/window/view_form/view/form_gtk/many2many.py b/tryton/gui/window/view_form/view/form_gtk/many2many.py index 7ae5c416aa..63f290d689 100644 --- a/tryton/gui/window/view_form/view/form_gtk/many2many.py +++ b/tryton/gui/window/view_form/view/form_gtk/many2many.py @@ -170,7 +170,10 @@ class Many2Many(Widget): new=self.attrs.get('create', True), title=self.attrs.get('string')) win.screen.search_filter(quote(value)) - win.show() + if len(win.screen.group) == 1: + win.response(None, gtk.RESPONSE_OK) + else: + win.show() def _sig_remove(self, *args): self.screen.remove(remove=True)