Files
odoo_source/addons/hr_homeworking/models
Victor Piryns (pivi) ba83922654 [PERF] hr_homeworking: remove .id from left leafs of domains
Description:
Domains of the form
```python
[('stored_Many2X.id', '=/!=/in/not in', list_of_ids)]
```
will force the ORM to generate a sub-`SELECT` (or `LEFT JOIN` in
case of `auto_join=True`), which is inefficient, as the `id` can be
retrieved directly from the current `model` table, instead of going
to fetch it from the `PKey` of the `comodel` table.

There is just one *important* detail - in the sub-select, the `ir.rule`
of the `comodel` is applied, which is not the case when directly
referencing the `field` from the `model`. So in some cases using an
explicit `.id` would be a wanted, if the intention was to apply the
`ir.rule`.

Fix:
Remove the `.id` from left leafs of domains that if the field is
stored, and the `comodel` doesn't have `ir.rule` associated with it,
or the `ir.rule` application is redundant/not needed.
`.id`

task-3735923

closes odoo/odoo#153475

Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
2024-02-12 20:24:10 +00:00
..