Skip to content

Commit 5f12f8d

Browse files
authored
Merge pull request OCA#5404 from Tecnativa/18.0-ou_fix-hr_timesheet-progress
[18.0][OU-FIX] hr_timesheet: Convert task progress
2 parents edb78c8 + 5506575 commit 5f12f8d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,26 @@
11
# Copyright 2025 Le Filament (https://le-filament.com)
2+
# Copyright 2025 Tecnativa - Pedro M. Baeza
23
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
34
from openupgradelib import openupgrade
45

56

7+
def _convert_task_progress(env):
8+
"""On v17, the value was multiplied by 100:
9+
10+
https://github.com/odoo/odoo/blob/f9726cfe93e8850a38d9de06acfa5d78473b50b0/addons/hr_timesheet/models/project_task.py#L101
11+
12+
but on v18, it's not:
13+
14+
https://github.com/odoo/odoo/blob/1cac54db8634267a780b4011291f1e8a80ac5f5b/addons/hr_timesheet/models/project_task.py#L98
15+
16+
so we have to divide current stored values by 100.
17+
"""
18+
openupgrade.logged_query(
19+
env.cr, "UPDATE project_task SET progress = progress / 100"
20+
)
21+
22+
623
@openupgrade.migrate()
724
def migrate(env, version):
825
openupgrade.load_data(env, "hr_timesheet", "18.0.1.1/noupdate_changes.xml")
26+
_convert_task_progress(env)

0 commit comments

Comments
 (0)