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
This commit is contained in:
Cédric Krier committed 2013-10-27 19:42:25 +01:00
1 parent f787cafd87
commit 7f7d6cf268
1 file changed
+6
@@ -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'])