[FIX] models: do not load custom fields with depends when partial=True

Upgrading a module in the presence of computed custom fields can fail, if a
computed custom field depends on another field from a module that is not loaded
yet.  The patch simply prevents custom fields with dependencies from being
loaded in partial mode.
This commit is contained in:
Raphael Collet
2016-03-15 14:30:39 +01:00
parent 14436409a3
commit ddafbab3e4
+2
View File
@@ -728,6 +728,8 @@ class BaseModel(object):
attrs['domain'] = eval(field['domain']) if field['domain'] else None
# add compute function if given
if field['compute']:
if partial and field['depends']:
continue
attrs['compute'] = make_compute(field['compute'], field['depends'])
self._add_field(name, Field.by_type[field['ttype']](**attrs))