[CLEAN] fields.py: added auto_join in one2many and many2one __init__, binded on _auto_join. Added some short explanations in fields.py about the attribute.

bzr revid: tde@openerp.com-20121205153410-07vo3j1c641xgmda
This commit is contained in:
Thibault Delavallée 2012-12-05 16:34:10 +01:00
parent 37051bbe91
commit ea01dfe9dd
1 changed files with 7 additions and 2 deletions

View File

@ -27,6 +27,9 @@
Fields Attributes:
* _classic_read: is a classic sql fields
* _type : field type
* _auto_join: for one2many and many2one fields, tells whether select
queries will join the relational table instead of replacing the
field condition by an equivalent-one based on a search.
* readonly
* required
* size
@ -428,9 +431,10 @@ class many2one(_column):
_symbol_f = lambda x: x or None
_symbol_set = (_symbol_c, _symbol_f)
def __init__(self, obj, string='unknown', **args):
def __init__(self, obj, string='unknown', auto_join=False, **args):
_column.__init__(self, string=string, **args)
self._obj = obj
self._auto_join = auto_join
def get(self, cr, obj, ids, name, user=None, context=None, values=None):
if context is None:
@ -497,11 +501,12 @@ class one2many(_column):
_prefetch = False
_type = 'one2many'
def __init__(self, obj, fields_id, string='unknown', limit=None, **args):
def __init__(self, obj, fields_id, string='unknown', limit=None, auto_join=False, **args):
_column.__init__(self, string=string, **args)
self._obj = obj
self._fields_id = fields_id
self._limit = limit
self._auto_join = auto_join
#one2many can't be used as condition for defaults
assert(self.change_default != True)