From 763fca0d3003fdadba9678e0af7ed8644d5aed66 Mon Sep 17 00:00:00 2001 From: Quentin Mondot Date: Wed, 19 Nov 2025 13:51:56 +0100 Subject: [PATCH] [IMP] project_working_time_task_portal : recompute billable and non billable effective hours when timesheets exclude_from_sale_order is modified --- project_working_time_task_portal/__manifest__.py | 2 +- .../migrations/16.0.1.0.5/post-migration.py | 7 +++++++ project_working_time_task_portal/models/billable_time.py | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 project_working_time_task_portal/migrations/16.0.1.0.5/post-migration.py diff --git a/project_working_time_task_portal/__manifest__.py b/project_working_time_task_portal/__manifest__.py index a03a72b..fbd8725 100644 --- a/project_working_time_task_portal/__manifest__.py +++ b/project_working_time_task_portal/__manifest__.py @@ -3,7 +3,7 @@ { "name": "project_working_time_task_portal", - "version": "16.0.1.0.4", + "version": "16.0.1.0.5", "author": "Elabore", "website": "https://elabore.coop", "maintainer": "Boris Gallet", diff --git a/project_working_time_task_portal/migrations/16.0.1.0.5/post-migration.py b/project_working_time_task_portal/migrations/16.0.1.0.5/post-migration.py new file mode 100644 index 0000000..9e0d382 --- /dev/null +++ b/project_working_time_task_portal/migrations/16.0.1.0.5/post-migration.py @@ -0,0 +1,7 @@ +from odoo import SUPERUSER_ID, api + +def migrate(cr, version): + env = api.Environment(cr, SUPERUSER_ID, {}) + + tasks = env["project.task"].search([("stage_id.fold", "=", False)]) + tasks._compute_billable_effective_hours() diff --git a/project_working_time_task_portal/models/billable_time.py b/project_working_time_task_portal/models/billable_time.py index 5bec0e5..f120514 100644 --- a/project_working_time_task_portal/models/billable_time.py +++ b/project_working_time_task_portal/models/billable_time.py @@ -59,7 +59,7 @@ class Task(models.Model): help="Non billable time spent on this task and its sub-tasks (and their own sub-tasks).", ) - @api.depends('timesheet_ids.unit_amount') + @api.depends('timesheet_ids.unit_amount', 'timesheet_ids.exclude_from_sale_order') def _compute_billable_effective_hours(self): if not any(self._ids): for task in self: