summaryrefslogtreecommitdiff
path: root/odoo
diff options
context:
space:
mode:
authorToufik Ben Jaa <tbe@odoo.com>2020-02-28 15:23:34 +0000
committerToufik Ben Jaa <tbe@odoo.com>2020-03-03 12:19:10 +0000
commitac32c3ea6c0c61fc6c48f1671067fe851ec683eb (patch)
tree064a483f9f2f677f18c1f8389b52b057fa9a4bed /odoo
parented3f448e682a1fec032a52f9090ded5fdffa948a (diff)
[FIX] models: crash on one2many fields without inverse
- In some cases One2many fields defined as computed without inverse field defined could cause crashes if it is used in a search. This should not be done, but shouldn't crash either. With this fix, trying to search on one of this fields would just print a warning. closes odoo/odoo#46742 X-original-commit: 4b4f1623590f2e872c565e8e56002bc3f5bf9efe Signed-off-by: Toufik Benjaa (tbe) <tbe@odoo.com>
Diffstat (limited to 'odoo')
-rw-r--r--odoo/models.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/odoo/models.py b/odoo/models.py
index afe8b5345a2..bbec718b5a3 100644
--- a/odoo/models.py
+++ b/odoo/models.py
@@ -4346,7 +4346,7 @@ Record ids: %(records)s
to_flush[model._name].add(f)
if rfield.type in ('many2one', 'one2many', 'many2many'):
model = self.env[rfield.comodel_name]
- if rfield.type == 'one2many':
+ if rfield.type == 'one2many' and rfield.inverse_name:
to_flush[rfield.comodel_name].add(rfield.inverse_name)
if field.comodel_name:
model_name = field.comodel_name