[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:
parent
37051bbe91
commit
ea01dfe9dd
|
@ -27,6 +27,9 @@
|
||||||
Fields Attributes:
|
Fields Attributes:
|
||||||
* _classic_read: is a classic sql fields
|
* _classic_read: is a classic sql fields
|
||||||
* _type : field type
|
* _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
|
* readonly
|
||||||
* required
|
* required
|
||||||
* size
|
* size
|
||||||
|
@ -428,9 +431,10 @@ class many2one(_column):
|
||||||
_symbol_f = lambda x: x or None
|
_symbol_f = lambda x: x or None
|
||||||
_symbol_set = (_symbol_c, _symbol_f)
|
_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)
|
_column.__init__(self, string=string, **args)
|
||||||
self._obj = obj
|
self._obj = obj
|
||||||
|
self._auto_join = auto_join
|
||||||
|
|
||||||
def get(self, cr, obj, ids, name, user=None, context=None, values=None):
|
def get(self, cr, obj, ids, name, user=None, context=None, values=None):
|
||||||
if context is None:
|
if context is None:
|
||||||
|
@ -497,11 +501,12 @@ class one2many(_column):
|
||||||
_prefetch = False
|
_prefetch = False
|
||||||
_type = 'one2many'
|
_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)
|
_column.__init__(self, string=string, **args)
|
||||||
self._obj = obj
|
self._obj = obj
|
||||||
self._fields_id = fields_id
|
self._fields_id = fields_id
|
||||||
self._limit = limit
|
self._limit = limit
|
||||||
|
self._auto_join = auto_join
|
||||||
#one2many can't be used as condition for defaults
|
#one2many can't be used as condition for defaults
|
||||||
assert(self.change_default != True)
|
assert(self.change_default != True)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue