Skip to content

Commit

Permalink
[FIX] fields: make sure fields are set up before using them
Browse files Browse the repository at this point in the history
Non-setup fields could cause problems in two places:
- when traversing the chain of fields in related fields;
- when adding recomputation triggers on inverse fields

Both issues are fixed by this patch.
  • Loading branch information
rco-odoo committed Dec 11, 2014
1 parent 107ba24 commit 058eaf0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions openerp/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ def _setup_related(self, env):
for name in self.related:
recs._setup_fields()
field = recs._fields[name]
field.setup(env)
recs = recs[name]
fields.append(field)

Expand Down Expand Up @@ -569,6 +570,8 @@ def _setup_dependency(self, path0, model, path1):
self.recursive = True
continue

field.setup(env)

#_logger.debug("Add trigger on %s to recompute %s", field, self)
field._triggers.add((self, '.'.join(path0 or ['id'])))

Expand Down

0 comments on commit 058eaf0

Please sign in to comment.