odoo/odoo#97316

Created by Platform, Xavier Alt (xal)
Merged at 567d27cc600bdbb39d62e7aa75b37d48b33d27a5

Statuses:

label
odoo-dev:saas-15.3-rating-last-value-deterministic-xal
head
3d0fc091b5a758a5a6a8f19675599fac71357c37
merged
3 years ago by Marketing, Thibault Delavallee (tde)
odoo/odoo
saas-15.3 #97316
saas-15.4 #97683
16.0
17.0
18.0
saas-18.1
saas-18.2
saas-18.3
master #97691

[FIX] rating: ensure `rating_last_value` computation is deterministic

Running tests for project module only fails with the following error:

2022-08-02 08:19:41,777 5669 ERROR testdb odoo.addons.project.tests.test_project_report: FAIL: TestProjectReport.test_avg_rating_measure
Traceback (most recent call last):
  File "/build/odoo/saas-15.3/addons/project/tests/test_project_report.py", line 22, in test_avg_rating_measure
    self.assertEqual(self.task_1.rating_last_value, 5.0)
AssertionError: 4.0 != 5.0

With the ORM flush mechanisms when multiple ratings are created at once
they all have the same create_date and/or write_date, this commit
ensure the order is deterministic.

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr