diff options
| author | jem-odoo <jem@openerp.com> | 2018-10-25 13:33:20 +0000 |
|---|---|---|
| committer | jem-odoo <jem@openerp.com> | 2018-12-04 12:48:13 +0000 |
| commit | 47479401cb3f685788d76abe01d3d2bc21ff11e3 (patch) | |
| tree | fedaa6b376f0a0f56da727140d58dcf51b95271f /addons/project/tests | |
| parent | 605e999dc43ed634bf058d55028d76e9e21af678 (diff) | |
[IMP] rating: introduce the parent mixin
When creating a task, the satisfaction of the project is recomputed even
if the task has not rating. This can lead to performance issue:
concurrency error in Postgresql can happen if a task is created when
somebody else tries to update the project.
The satisfaction recomputation will give and concurrency error whereas
it will return the same satisfaction percentage, since the task has no
rating. The same problem will happens in every modules implementing
the rating feature: project, helpdesk and livechat.
This problem leads us to create the rating.parent.mixin in order to
retrigger the computation only when a new rating appears on the
parent object. We also unstore the field to make its computation lazy.
Maybe in a near future, this field will be computed in SQL directly.
The parent mixin allow us to standardize the behavior to all parent
rating models.
These optimizations should reduce the number of computation and speed
up the task creation.
opw-1902502
Task-1903565
Diffstat (limited to 'addons/project/tests')
| -rw-r--r-- | addons/project/tests/test_project_flow.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/addons/project/tests/test_project_flow.py b/addons/project/tests/test_project_flow.py index 944e018d7a5..2735b07d1c2 100644 --- a/addons/project/tests/test_project_flow.py +++ b/addons/project/tests/test_project_flow.py @@ -164,6 +164,7 @@ class TestProjectFlow(TestProjectBase): self.assertEqual(rating_bad.rating_text, 'not_satisfied') self.assertEqual(first_task.rating_count, 1, "Task should have only one rating associated, since one is not consumed") self.assertEqual(rating_good.parent_res_id, self.project_pigs.id) + self.assertEqual(self.project_goats.percentage_satisfaction_task, -1) self.assertEqual(self.project_pigs.percentage_satisfaction_task, -1) |
