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 8fb545bb06..7ae5c416aa 100644 --- a/tryton/gui/window/view_form/view/form_gtk/many2many.py +++ b/tryton/gui/window/view_form/view/form_gtk/many2many.py @@ -47,7 +47,7 @@ class Many2Many(Widget): self.wid_text = PlaceholderEntry() self.wid_text.set_placeholder_text(_('Search')) self.wid_text.set_property('width_chars', 13) - self.wid_text.connect('focus-out-event', lambda *a: self._focus_out()) + self.wid_text.connect('focus-out-event', self._focus_out) self.focus_out = True hbox.pack_start(self.wid_text, expand=True, fill=True) @@ -139,6 +139,7 @@ class Many2Many(Widget): return False def destroy(self): + self.wid_text.disconnect_by_func(self._focus_out) self.screen.destroy() def _sig_add(self, *args): diff --git a/tryton/gui/window/view_form/view/form_gtk/one2many.py b/tryton/gui/window/view_form/view/form_gtk/one2many.py index 84ed251ee8..b913abe493 100644 --- a/tryton/gui/window/view_form/view/form_gtk/one2many.py +++ b/tryton/gui/window/view_form/view/form_gtk/one2many.py @@ -90,8 +90,7 @@ class One2Many(Widget): self.wid_text = PlaceholderEntry() self.wid_text.set_placeholder_text(_('Search')) self.wid_text.set_property('width_chars', 13) - self.wid_text.connect('focus-out-event', - lambda *a: self._focus_out()) + self.wid_text.connect('focus-out-event', self._focus_out) hbox.pack_start(self.wid_text, expand=True, fill=True) if int(self.attrs.get('completion', 1)): @@ -235,6 +234,8 @@ class One2Many(Widget): return False def destroy(self): + if self.attrs.get('add_remove'): + self.wid_text.disconnect_by_func(self._focus_out) self.screen.destroy() def _on_activate(self): diff --git a/tryton/gui/window/view_form/view/form_gtk/widget.py b/tryton/gui/window/view_form/view/form_gtk/widget.py index 9940ad5d85..ab744378b3 100644 --- a/tryton/gui/window/view_form/view/form_gtk/widget.py +++ b/tryton/gui/window/view_form/view/form_gtk/widget.py @@ -86,7 +86,7 @@ class Widget(object): self.visible = True widget.show() - def _focus_out(self): + def _focus_out(self, *args): if not self.field: return False if not self.visible: