diff --git a/openerp/fields.py b/openerp/fields.py index 6a2f0f75fd1..3e0b2a35f76 100644 --- a/openerp/fields.py +++ b/openerp/fields.py @@ -251,6 +251,7 @@ class Field(object): automatic = False # whether the field is automatically created ("magic" field) inherited = False # whether the field is inherited (_inherits) column = None # the column interfaced by the field + setup_done = False # whether the field has been set up name = None # name of the field type = None # type of the field (string) @@ -346,7 +347,7 @@ class Field(object): def reset(self): """ Prepare `self` for a new setup. """ - self._setup_done = False + self.setup_done = False # self._triggers is a set of pairs (field, path) that represents the # computed fields that depend on `self`. When `self` is modified, it # invalidates the cache of each `field`, and registers the records to @@ -359,8 +360,8 @@ class Field(object): and other properties). This method is idempotent: it has no effect if `self` has already been set up. """ - if not self._setup_done: - self._setup_done = True + if not self.setup_done: + self.setup_done = True self._setup(env) def _setup(self, env): diff --git a/openerp/models.py b/openerp/models.py index 603096c926b..35e06db3df0 100644 --- a/openerp/models.py +++ b/openerp/models.py @@ -3042,6 +3042,8 @@ class BaseModel(object): for fname, field in self._fields.iteritems(): if allfields and fname not in allfields: continue + if not field.setup_done: + continue if field.groups and not recs.user_has_groups(field.groups): continue res[fname] = field.get_description(recs.env)