diff options
| author | Raphael Collet <rco@odoo.com> | 2019-09-23 12:40:17 +0000 |
|---|---|---|
| committer | Sébastien Theys <seb@odoo.com> | 2019-09-23 20:55:39 +0000 |
| commit | 50c7941fa67133a29c3a1032f799a1135950198c (patch) | |
| tree | 951a0fdc5da5a27852c7a7ed61fcc8ba4569f38c /odoo/fields.py | |
| parent | 97cee756cc226a49263c4f97b6d6b977659edf64 (diff) | |
[FIX] fields: set `model_field` on related `many2one_reference` fields
This fixes an issue when a Model A with a `many2one_reference` is inherited in
Model B with `_inherits`, and another Model C defines a `one2many` having as
inverse the inherited `many2one_reference` in Model B.
Without this commit, the value of `model_field` is `False` by default for the
field in B, which would lead to incorrect queries when building
`get_domain_list` for the `one2many`.
Diffstat (limited to 'odoo/fields.py')
| -rw-r--r-- | odoo/fields.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/odoo/fields.py b/odoo/fields.py index f3167b3ce77..22f5d1d56c3 100644 --- a/odoo/fields.py +++ b/odoo/fields.py @@ -2483,11 +2483,12 @@ class Many2one(_Relational): class Many2oneReference(Integer): type = 'many2one_reference' - _slots = { 'model_field': None, } + _related_model_field = property(attrgetter('model_field')) + def convert_to_cache(self, value, record, validate=True): # cache format: id or None if isinstance(value, BaseModel): |
