diff options
| author | Raphael Collet <rco@odoo.com> | 2018-04-17 16:57:39 +0200 |
|---|---|---|
| committer | Raphael Collet <rco@odoo.com> | 2018-04-18 17:26:05 +0200 |
| commit | 23431389c36e57bfce99afb97abfca6a062cfc74 (patch) | |
| tree | 95d676620c79d96514916166beacf4d681a555d5 /odoo/models.py | |
| parent | 87b42ad9a887faacbbefcab9dd0703a5c51ce28b (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.
OPW 1835872
Diffstat (limited to 'odoo/models.py')
| -rw-r--r-- | odoo/models.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/odoo/models.py b/odoo/models.py index f5c8a84595d..d04e6642254 100644 --- a/odoo/models.py +++ b/odoo/models.py @@ -2734,6 +2734,7 @@ class BaseModel(object): # - copy inherited fields iff their original field is copied fields[name] = field.new( inherited=True, + inherited_field=field, related=(parent_field, name), related_sudo=False, copy=field.copy, @@ -2850,7 +2851,7 @@ class BaseModel(object): try: field.setup_full(self) except Exception: - if partial and field.manual: + if partial and field.base_field.manual: # Something goes wrong when setup a manual field. # This can happen with related fields using another manual many2one field # that hasn't been loaded because the comodel does not exist yet. |
