From 7f7d6cf268eba377bbb502092ec770aa28fda16c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 27 Oct 2013 19:42:25 +0100 Subject: [PATCH] Add support for add_remove on many2many widget If a one2many is displayed with the many2many widget, the widget should support the add_remove attribute. review1231002 --- tryton/gui/window/view_form/view/form_gtk/many2many.py | 6 ++++++ 1 file changed, 6 insertions(+) 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 00766107a0..1a1a070165 100644 --- a/tryton/gui/window/view_form/view/form_gtk/many2many.py +++ b/tryton/gui/window/view_form/view/form_gtk/many2many.py @@ -146,6 +146,9 @@ class Many2Many(WidgetInterface): if not self.focus_out: return domain = self.field.domain_get(self.record) + add_remove = self.record.expr_eval(self.attrs.get('add_remove')) + if add_remove: + domain = [domain, add_remove] context = self.field.context_get(self.record) value = self.wid_text.get_text() @@ -263,6 +266,9 @@ class Many2Many(WidgetInterface): elif index == 1: model = self.attrs['relation'] domain = self.field.domain_get(self.record) + add_remove = self.record.expr_eval(self.attrs.get('add_remove')) + if add_remove: + domain = [domain, add_remove] context = self.field.context_get(self.record) screen = Screen(model, domain, context=context, mode=['form'])