From ec64d492e4ef92d3f2671a160bf9e1df4fd856f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 30 Sep 2008 22:25:37 +0200 Subject: [PATCH] Open search window in many2many even if there is only one result if there is no text in the entry for issue404 --- tryton/gui/window/view_form/view/form_gtk/many2many.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 4fa8377c94..7a4a3dbaa1 100644 --- a/tryton/gui/window/view_form/view/form_gtk/many2many.py +++ b/tryton/gui/window/view_form/view/form_gtk/many2many.py @@ -70,17 +70,18 @@ class Many2Many(WidgetInterface): def _sig_add(self, *args): domain = self._view.modelfield.domain_get(self._view.model) context = self._view.modelfield.context_get(self._view.model) + value = self.wid_text.get_text() try: ids = rpc.execute('object', 'execute', self.attrs['relation'], 'name_search', - self.wid_text.get_text(), domain, 'ilike', context, + value, domain, 'ilike', context, _LIMIT) except Exception, exception: common.process_exception(exception, self._window) return False ids = [x[0] for x in ids] - if len(ids) != 1: + if len(ids) != 1 or not value: win = WinSearch(self.attrs['relation'], sel_multi=True, ids=ids, context=context, domain=domain, parent=self._window, views_preload=self.attrs.get('views', {}))