Skip to content

Commit 3b4996c

Browse files
committed
[FIX] hr_timesheet: show percentage in project task progressbar
Steps to reproduce: - Install Field service app. - Go to Field Service app and create a new task, with Allocated Time of 5 hours. - In the new ticket, Log 5 hours in the TimeSheets tab. - Go to the tasks list. - Notice how the progress bar of the new task shows 1 instead of 100 although 5 out of 5 hours have been logged. Investigation: - 8389722 introduced the new ProjectTaskProgressBarField component. - 4a93d9a introudced a change to calculate the task.progress as a fraction instead of a percentage https://github.com/odoo/odoo/blob/7280dd53bc14f7c398c63a1f719987bcab7c257a/addons/hr_timesheet/models/project_task.py#L102 - But the ProjectTaskProgressBarField wasn't adapted to that change working with percentage values. opw-3790397 closes odoo#158501 X-original-commit: 91dd4cc Signed-off-by: Xavier Bol (xbo) <[email protected]> Signed-off-by: Ali Hassan Youssef (alhy) <[email protected]>
1 parent 30d2f8c commit 3b4996c

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

addons/hr_timesheet/static/src/components/progress_bar/project_task_progress_bar_field.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import { registry } from "@web/core/registry";
44
import { progressBarField, ProgressBarField } from "@web/views/fields/progress_bar/progress_bar_field";
55

66
export class ProjectTaskProgressBarField extends ProgressBarField {
7+
get currentValue() {
8+
return super.currentValue * 100;
9+
}
10+
711
get progressBarColorClass() {
812
if (this.currentValue > this.maxValue) {
913
return super.progressBarColorClass;

addons/hr_timesheet/static/tests/hr_timesheet_common_tests.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ export const getServerData = () => JSON.parse(JSON.stringify({
3939
progress: { string: "progress", type: "float" },
4040
},
4141
records: [
42-
{ id: 1, name: "Task 1\u00A0AdditionalInfo", project_id: 1, progress: 50 },
43-
{ id: 2, name: "Task 2\u00A0AdditionalInfo", project_id: 1, progress: 80 },
44-
{ id: 3, name: "Task 3\u00A0AdditionalInfo", project_id: 1, progress: 104 },
42+
{ id: 1, name: "Task 1\u00A0AdditionalInfo", project_id: 1, progress: 0.5 },
43+
{ id: 2, name: "Task 2\u00A0AdditionalInfo", project_id: 1, progress: 0.8 },
44+
{ id: 3, name: "Task 3\u00A0AdditionalInfo", project_id: 1, progress: 1.04 },
4545
],
4646
},
4747
},

0 commit comments

Comments
 (0)