The use-case that motivated this fix is the deletion of a project task
with many subtasks. The field 'project_id' on tasks is recursively
computed, and some automated action must be executed when its value
corresponds to a given project.
The issue occurs when the domain of automated actions is evaluated by
method search(), because the latter flushes the fields to search on,
which are also the ones being recomputed. Combined with the fact that
recursive fields are not computed in batch, this leads to a huge amount
of recursive calls between the automated action and flush().
The execution of task.unlink() looks like this:
- mark 'project_id' to compute on subtasks
- delete task
- flush()
- recompute 'project_id' on subtask1
- call compute on subtask1
- in action, search([('id', 'in', subtask1.ids), ('project_id', '=', pid)])
- flush(['id', 'project_id'])
- recompute 'project_id' on subtask2
- call compute on subtask2
- in action, search([('id', 'in', subtask2.ids), ('project_id', '=', pid)])
- flush(['id', 'project_id'])
- recompute 'project_id' on subtask3
- call compute on subtask3
- in action, search([('id', 'in', subtask3.ids), ('project_id', '=', pid)])
- flush(['id', 'project_id'])
- recompute 'project_id' on subtask4
...
closesodoo/odoo#80141
X-original-commit: e2788b580ef15ef3083ac919737a46d850143832
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
If some filter domains use M2O to models current user cannot access,
using sudo() permit to filter even when user cannot access linked
models.
for the accuracy of the fix, add a unit test which reproduce the exact
reported bug.
closesodoo/odoo#44923
X-original-commit: 30e2153539643491fad889811a54a8e580fa9c58
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Purpose
=======
This module contains tests related to base automation. It makes no
sense as they have no business value.
Specification
=============
Move all the tests to a separate module as it contains models used only
to perform tests independently to functional aspects of other models.