From 6765a12e5a9dcebbd7de820ae3b1cdd46a325b39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 1 Sep 2014 12:53:32 +0200 Subject: [PATCH] Add add_remove alias on Many2Many for compatibility with One2Many issue4112 review5511002 --- doc/ref/models/fields.rst | 4 ++++ trytond/model/fields/many2many.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/doc/ref/models/fields.rst b/doc/ref/models/fields.rst index d69afe8d7f..a7af4894e0 100644 --- a/doc/ref/models/fields.rst +++ b/doc/ref/models/fields.rst @@ -611,6 +611,10 @@ This field accepts as written value a list of tuples like the :class:`One2Many`. An integer or a PYSON expression denoting the maximum number of records allowed in the relation. +.. attribute:: Many2Many.add_remove + + An alias to the :attr:`domain` for compatibility with the :class:`One2Many`. + Instance methods: .. method:: Many2Many.get_target() diff --git a/trytond/model/fields/many2many.py b/trytond/model/fields/many2many.py index 9124062cc0..46f4da542a 100644 --- a/trytond/model/fields/many2many.py +++ b/trytond/model/fields/many2many.py @@ -58,6 +58,10 @@ class Many2Many(Field): size = property(_get_size, _set_size) + @property + def add_remove(self): + return self.domain + def get(self, ids, model, name, values=None): ''' Return target records ordered.