diff options
| author | Raphael Collet <rco@odoo.com> | 2020-05-05 12:56:14 +0000 |
|---|---|---|
| committer | Raphael Collet <rco@odoo.com> | 2020-05-20 07:58:50 +0000 |
| commit | 538f428787d15725383474a89e656c05a8c0b9fa (patch) | |
| tree | b1d27982d932fae0482aa79848b2865ce589211f /addons/web/static/src/js/views/basic/basic_controller.js | |
| parent | 84a595301edeb558f93ce5509efdcd8e30fd2a64 (diff) | |
[FIX] expression: auto_join now uses LEFT JOIN
This fixes some cases where search results are actually missing. For
instance, searching with a domain like
['|', ('parent_id.name', '=', 'foo'), ('name', 'like', 'foo')]
where `parent_id` is auto-joined, misses results where `parent_id` is
NULL, because the actual query makes cartesian products for auto-joins:
SELECT "res_partner".id
FROM "res_partner", "res_partner" AS "res_partner__parent_id"
WHERE ("res_partner"."parent_id" = "res_partner__parent_id"."id")
AND ("res_partner__parent_id"."name" = 'foo' OR "res_partner"."name" == 'foo')
Using LEFT JOIN instead of cartesian product above, the query includes
all results where `parent_id` is NULL:
SELECT "res_partner".id
FROM "res_partner"
LEFT JOIN "res_partner" AS "res_partner__parent_id" ON
("res_partner"."parent_id" = "res_partner__parent_id"."id")
WHERE ("res_partner__parent_id"."name" = 'foo' OR "res_partner"."name" == 'foo')
Diffstat (limited to 'addons/web/static/src/js/views/basic/basic_controller.js')
0 files changed, 0 insertions, 0 deletions
