diff --git a/odoo/addons/test_new_api/tests/test_properties.py b/odoo/addons/test_new_api/tests/test_properties.py index c3afce57d5f..9e7f658e5b0 100644 --- a/odoo/addons/test_new_api/tests/test_properties.py +++ b/odoo/addons/test_new_api/tests/test_properties.py @@ -2014,6 +2014,11 @@ class PropertiesSearchCase(TestPropertiesMixin): with self.assertRaises(UserError), self.assertQueryCount(0): self.env['test_new_api.message'].search(domain=[], order=order) + @mute_logger('odoo.fields') + def test_properties_field_search(self): + with self.assertRaises(ValueError): + self.env['test_new_api.message'].search([('attributes', '=', '"Test"')]) + class PropertiesGroupByCase(TestPropertiesMixin): @classmethod diff --git a/odoo/osv/expression.py b/odoo/osv/expression.py index dc887ec550e..7dcb49fd46c 100644 --- a/odoo/osv/expression.py +++ b/odoo/osv/expression.py @@ -1023,7 +1023,7 @@ class expression(object): push(dom_leaf, model, alias) elif field.type == 'properties': - if len(path) != 2 and "." in path[1]: + if len(path) != 2 or "." in path[1]: raise ValueError(f"Wrong path {path}") elif operator not in ('=', '!=', '>', '>=', '<', '<=', 'in', 'not in', 'like', 'ilike', 'not like', 'not ilike'): raise ValueError(f"Wrong search operator {operator!r}")