Skip to content
Snippets Groups Projects
Commit fd24ac10 authored by Raphael Collet's avatar Raphael Collet
Browse files

[FIX] expression: performance of search on one2many fields


We optimize the search on domains like `[('line_ids', 'in', ids)]`.
The condition is rewritten `('id', 'in', ids1)` where `ids1` is the
result of

    SELECT <many2one_field> FROM <comodel_table> WHERE id IN <ids>

The issue is that the latter potentially returns many duplicate values.
The fix consists in having as few duplicates as possible in `ids1`.

Note that domains like `[('line_ids.foo', '=', 42)]` implicitly benefit
from the optimization, as they are rewritten as the one above with

    ids = comodel.search([('foo', '=', 42)]).ids

closes odoo/odoo#43566

X-original-commit: a13c05fa
Signed-off-by: default avatarRaphael Collet (rco) <rco@openerp.com>
parent 4b2e235b
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment