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 1c638eef93..c7442b2c53 100644 --- a/tryton/gui/window/view_form/view/form_gtk/many2many.py +++ b/tryton/gui/window/view_form/view/form_gtk/many2many.py @@ -164,7 +164,10 @@ class Many2Many(Widget): title=self.attrs.get('string')) win.screen.search_filter(quote(value)) if len(win.screen.group) == 1: - win.response(None, Gtk.ResponseType.OK) + callback([ + (r.id, r.value.get('rec_name', '')) + for r in win.screen.group]) + win.destroy() else: win.show() diff --git a/tryton/gui/window/view_form/view/form_gtk/many2one.py b/tryton/gui/window/view_form/view/form_gtk/many2one.py index 5bb3ed3c2c..1dff81b434 100644 --- a/tryton/gui/window/view_form/view/form_gtk/many2one.py +++ b/tryton/gui/window/view_form/view/form_gtk/many2one.py @@ -136,7 +136,10 @@ class Many2One(Widget): exclude_field=self.attrs.get('relation_field')) win.screen.search_filter(quote(text)) if len(win.screen.group) == 1: - win.response(None, Gtk.ResponseType.OK) + callback([ + (r.id, r.value.get('rec_name', '')) + for r in win.screen.group]) + win.destroy() else: win.show() return