[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>
This commit is contained in:
+1
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user