diff options
| author | Manuel Vázquez Acosta <manuel@merchise.org> | 2019-04-09 19:05:18 +0000 |
|---|---|---|
| committer | fw-bot <otis@odoo.com> | 2019-11-12 14:49:52 +0000 |
| commit | d57cd2d3ce07564f23d13503c9b856123d704912 (patch) | |
| tree | 3c239595df3f65fb5e5d170c3044e67540709743 /addons/website/security | |
| parent | 3942308bc4843133b3713fb342be1e54b2eab409 (diff) | |
[FIX] base: Correct optimization of name_search
Commit 5fcf891e07bf61518e6bf0be0dc4f27859d45778 introduced optimizations for
name_search in several models. However, that produces some counter-intuitive
searches.
In a DB with project and custom data:
>>> Project = self.env['project.task']
>>> Project.search([('user_id', 'ilike', 'demo')]).mapped('user_id.name')
['Marc Demo']
>>> Project.search([('user_id', 'not ilike', 'demo')]).mapped('user_id.name')
['Marc Demo']
The projects returned with 'not ilike' are a super-set of those returned with
'ilike':
>>> Project.search([('user_id', 'ilike', 'demo')])
project.task(22, 21, 20, 16, 14, 13)
>>> Project.search([('user_id', 'not ilike', 'demo')])
project.task(22, 21, 29, 28, 27, 26, 25, 20, 16, 14, 13, 31, 30)
This commit fix this behaviour by choosing '!=' instead of '=' whenever the
operator is a negation operator.
The 'res.users' is more exposed than the other models touched by
5fcf891e07bf61518e6bf0be0dc4f27859d45778, because user may search for 'Created
by' in the web client.
closes odoo/odoo#40140
X-original-commit: b3c539b09a0bd462309a10c565cb91375a7011b9
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Diffstat (limited to 'addons/website/security')
0 files changed, 0 insertions, 0 deletions
