diff options
| author | jem-odoo <jem@openerp.com> | 2018-12-03 12:49:21 +0000 |
|---|---|---|
| committer | jem-odoo <jem@openerp.com> | 2019-08-13 12:16:26 +0000 |
| commit | 76f01bfe8cf2106eade2bcaacd89ed6e9fce142e (patch) | |
| tree | 5ca3f6c1a89302ba113416b4d0eb9a82e097e5dd /addons | |
| parent | f499166df0a6392c7a74d4e09d02a946089c4b0a (diff) | |
[FIX] project: better computation of hours to close a task
Before this commit, the number of hours the task is
open is computed using the resource calendar. The same
measure expressed in days simply divide the number of
hour by 24. This is not what we intend: we want to know
the number of working days since the task was created,
and not a simple conversion from hours to days.
Task-37561
closes odoo/odoo#30092
Signed-off-by: Jérome Maes (jem) <jem@openerp.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/project/models/project.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/addons/project/models/project.py b/addons/project/models/project.py index 43fd0da2ab5..86c513695fd 100644 --- a/addons/project/models/project.py +++ b/addons/project/models/project.py @@ -548,15 +548,15 @@ class Task(models.Model): if task.date_assign: dt_date_assign = fields.Datetime.from_string(task.date_assign) - task.working_hours_open = task.project_id.resource_calendar_id.get_work_hours_count( - dt_create_date, dt_date_assign, compute_leaves=True) - task.working_days_open = task.working_hours_open / 24.0 + duration_data = task.project_id.resource_calendar_id.get_work_duration_data(dt_create_date, dt_date_assign, compute_leaves=True) + task.working_hours_open = duration_data['hours'] + task.working_days_open = duration_data['days'] if task.date_end: dt_date_end = fields.Datetime.from_string(task.date_end) - task.working_hours_close = task.project_id.resource_calendar_id.get_work_hours_count( - dt_create_date, dt_date_end, compute_leaves=True) - task.working_days_close = task.working_hours_close / 24.0 + duration_data = task.project_id.resource_calendar_id.get_work_duration_data(dt_create_date, dt_date_end, compute_leaves=True) + task.working_hours_close = duration_data['hours'] + task.working_days_close = duration_data['days'] (self - task_linked_to_calendar).update(dict.fromkeys( ['working_hours_open', 'working_hours_close', 'working_days_open', 'working_days_close'], 0.0)) |
