summaryrefslogtreecommitdiff
path: root/odoo/fields.py
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2016-10-28 17:05:21 +0200
committerChristophe Simonis <chs@odoo.com>2016-10-28 17:05:21 +0200
commit97debd09c066ca1f1ba4b0377b8f0a70499d3b88 (patch)
treef137b79898d3ec5f44ee8c0a39cd545c535a3a61 /odoo/fields.py
parentfb010a10045c2bcc05fd15df7bbb11e27eb74705 (diff)
parent57774efbea91b575d4ada214bdab7f00067e4bcf (diff)
[MERGE] forward port branch saas-12 up to 57774ef
Diffstat (limited to 'odoo/fields.py')
-rw-r--r--odoo/fields.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/odoo/fields.py b/odoo/fields.py
index 36086c0dfe2..e5cd453ed1d 100644
--- a/odoo/fields.py
+++ b/odoo/fields.py
@@ -301,7 +301,7 @@ class Field(object):
'args': EMPTY_DICT, # the parameters given to __init__()
'_attrs': EMPTY_DICT, # the field's non-slot attributes
'_module': None, # the field's module name
- 'setup_full_done': False, # whether the field has been fully setup
+ '_setup_done': None, # the field's setup state: None, 'base' or 'full'
'automatic': False, # whether the field is automatically created ("magic" field)
'inherited': False, # whether the field is inherited (_inherits)
@@ -345,7 +345,7 @@ class Field(object):
kwargs['string'] = string
args = {key: val for key, val in kwargs.iteritems() if val is not Default}
self.args = args or EMPTY_DICT
- self.setup_full_done = False
+ self._setup_done = None
def new(self, **kwargs):
""" Return a field of the same type as ``self``, with its own parameters. """
@@ -397,14 +397,15 @@ class Field(object):
def setup_base(self, model, name):
""" Base setup: things that do not depend on other models/fields. """
- if self.setup_full_done and not self.related:
+ if self._setup_done and not self.related:
# optimization for regular fields: keep the base setup
- self.setup_full_done = False
+ self._setup_done = 'base'
else:
# do the base setup from scratch
self._setup_attrs(model, name)
if not self.related:
self._setup_regular_base(model)
+ self._setup_done = 'base'
#
# Setup field parameter attributes
@@ -483,12 +484,12 @@ class Field(object):
def setup_full(self, model):
""" Full setup: everything else, except recomputation triggers. """
- if not self.setup_full_done:
+ if self._setup_done != 'full':
if not self.related:
self._setup_regular_full(model)
else:
self._setup_related_full(model)
- self.setup_full_done = True
+ self._setup_done = 'full'
#
# Setup of non-related fields