summaryrefslogtreecommitdiff
path: root/odoo/fields.py
diff options
context:
space:
mode:
authorRaphael Collet <rco@odoo.com>2018-04-17 16:57:39 +0200
committerRaphael Collet <rco@odoo.com>2018-04-19 10:00:49 +0200
commitc9caf55177359b404e4d752dcf1966ca58dccfda (patch)
treed2c1af18ce60c51cef6e3174da8f3f5b612d33b8 /odoo/fields.py
parent8c64159b8847dc465a21415c085d6526d280be02 (diff)
[FIX] models: bad setup of inherited custom fields
Assume a custom field F is defined on model 'res.partner'. The setup of F may silently fail because of missing stuff. In that situation, setting up the field inherited from F on model 'res.users' should also silently fail. To reproduce the bug, install Invoicing, create a related custom field F on 'res.partner' with 'property_account_position_id.active', and install another module. Setting up F after loading module 'base' will fail because the field 'property_account_position_id' does not exist yet. The error is not caught by the inheritance of F on model 'res.users', and the installation crashes.
Diffstat (limited to 'odoo/fields.py')
-rw-r--r--odoo/fields.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/odoo/fields.py b/odoo/fields.py
index caa36df49ef..a92d814d2bb 100644
--- a/odoo/fields.py
+++ b/odoo/fields.py
@@ -277,6 +277,7 @@ class Field(MetaField('DummyField', (object,), {})):
'automatic': False, # whether the field is automatically created ("magic" field)
'inherited': False, # whether the field is inherited (_inherits)
+ 'inherited_field': None, # the corresponding inherited field
'name': None, # name of the field
'model_name': None, # name of the model of this field
@@ -611,7 +612,7 @@ class Field(MetaField('DummyField', (object,), {})):
@property
def base_field(self):
""" Return the base field of an inherited field, or ``self``. """
- return self.related_field.base_field if self.inherited else self
+ return self.inherited_field.base_field if self.inherited_field else self
#
# Company-dependent fields