From ea01dfe9ddfe02dae9a35812b868ad5e84614d58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 5 Dec 2012 16:34:10 +0100 Subject: [PATCH] [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 --- openerp/osv/fields.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/openerp/osv/fields.py b/openerp/osv/fields.py index b15cebd29f5..b9096b31d57 100644 --- a/openerp/osv/fields.py +++ b/openerp/osv/fields.py @@ -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)