From 0ca324a6af28278844435fb3d30e9ccf15c849d3 Mon Sep 17 00:00:00 2001 From: Quentin Mondot Date: Tue, 18 Nov 2025 15:28:47 +0100 Subject: [PATCH] [IMP] project_working_time_task_portal : add non billable hours for subtasks --- project_working_time_task_portal/i18n/fr.po | 96 ++++++++++++++----- .../models/billable_time.py | 20 +++- .../views/hr_timesheet_view_task_form2.xml | 22 ++++- 3 files changed, 105 insertions(+), 33 deletions(-) diff --git a/project_working_time_task_portal/i18n/fr.po b/project_working_time_task_portal/i18n/fr.po index 1389982..ac029cc 100644 --- a/project_working_time_task_portal/i18n/fr.po +++ b/project_working_time_task_portal/i18n/fr.po @@ -4,10 +4,10 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 14.0\n" +"Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-12-04 09:37+0000\n" -"PO-Revision-Date: 2023-12-04 09:37+0000\n" +"POT-Creation-Date: 2025-11-18 14:17+0000\n" +"PO-Revision-Date: 2025-11-18 14:17+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -31,24 +31,9 @@ msgid "Subtask Planned Hours: " msgstr "Heures Planifiées Sous-tâches: " #. module: project_working_time_task_portal -#: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.portal_my_task_remaining_hours -msgid "Remaining Hours:" -msgstr "Heures restantes:" - -#. module: project_working_time_task_portal -#: model:ir.model.fields,field_description:project_working_time_task_portal.field_project_task__billable_remaining_hours -#: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.project_working_time_view_task_form -msgid "Billable Remaining Hours" -msgstr "Heures restantes facturables" -#. module: project_working_time_task_portal -#: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.portal_tasks_list_inherit -msgid "Billable Hours" -msgstr "Heures facturables" - -#. module: project_working_time_task_portal -#: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.project_working_time_view_task_form -msgid "Billable Remaining Days" -msgstr "Jours restants facturables" +#: model:ir.model,name:project_working_time_task_portal.model_account_analytic_line +msgid "Analytic Line" +msgstr "Ligne analytique" #. module: project_working_time_task_portal #: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.project_working_time_view_task_form @@ -62,9 +47,25 @@ msgid "Billable Effective Hours" msgstr "Heures passées facturables" #. module: project_working_time_task_portal -#: model:ir.model.fields,field_description:project_working_time_task_portal.field_project_task__subtask_billable_effective_hours -msgid "Subtask Billable Effective Hours" -msgstr "Heures passées facturables Sous-tâches" +#: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.portal_tasks_list_inherit +msgid "Billable Hours" +msgstr "Heures facturables" + +#. module: project_working_time_task_portal +#: model:ir.model.fields,field_description:project_working_time_task_portal.field_project_task__billable_progress +msgid "Billable Progress" +msgstr "" + +#. module: project_working_time_task_portal +#: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.project_working_time_view_task_form +msgid "Billable Remaining Days" +msgstr "Jours restants facturables" + +#. module: project_working_time_task_portal +#: model:ir.model.fields,field_description:project_working_time_task_portal.field_project_task__billable_remaining_hours +#: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.project_working_time_view_task_form +msgid "Billable Remaining Hours" +msgstr "Heures restantes facturables" #. module: project_working_time_task_portal #: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.project_working_time_view_task_form @@ -75,4 +76,49 @@ msgstr "Jours passés non facturables" #: model:ir.model.fields,field_description:project_working_time_task_portal.field_project_task__non_billable_effective_hours #: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.project_working_time_view_task_form msgid "Non Billable Effective Hours" -msgstr "Heures passées non facturables" \ No newline at end of file +msgstr "Heures passées non facturables" + +#. module: project_working_time_task_portal +#: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.portal_my_task_remaining_hours +msgid "Remaining Hours:" +msgstr "Heures restantes:" + +#. module: project_working_time_task_portal +#: model:ir.model.fields,field_description:project_working_time_task_portal.field_account_analytic_line__smart_search +#: model:ir.model.fields,field_description:project_working_time_task_portal.field_project_task__smart_search +msgid "Smart Search" +msgstr "" + +#. module: project_working_time_task_portal +#: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.project_working_time_view_task_form +msgid "Subtask Billable Effective Days" +msgstr "Sous-tâches jours passés facturables" + +#. module: project_working_time_task_portal +#: model:ir.model.fields,field_description:project_working_time_task_portal.field_project_task__subtask_billable_effective_hours +#: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.project_working_time_view_task_form +msgid "Subtask Billable Effective Hours" +msgstr "Sous-tâches heures passées facturables" + +#. module: project_working_time_task_portal +#: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.project_working_time_view_task_form +msgid "Subtask Non Billable Effective Days" +msgstr "Sous-tâches jours passés non facturables" + +#. module: project_working_time_task_portal +#: model:ir.model.fields,field_description:project_working_time_task_portal.field_project_task__subtask_non_billable_effective_hours +#: model_terms:ir.ui.view,arch_db:project_working_time_task_portal.project_working_time_view_task_form +msgid "Subtask Non Billable Effective Hours" +msgstr "Sous-tâches heures passées non facturables" + +#. module: project_working_time_task_portal +#: model:ir.model,name:project_working_time_task_portal.model_project_task +msgid "Task" +msgstr "Tâche" + +#. module: project_working_time_task_portal +#: model:ir.model.fields,help:project_working_time_task_portal.field_project_task__billable_remaining_hours +msgid "" +"Total Billable remaining time (without exclude_from_sale_order timesheet " +"lines), can be re-estimated periodically by the assignee of the task." +msgstr "" diff --git a/project_working_time_task_portal/models/billable_time.py b/project_working_time_task_portal/models/billable_time.py index b0c5dfd..0e38a8d 100644 --- a/project_working_time_task_portal/models/billable_time.py +++ b/project_working_time_task_portal/models/billable_time.py @@ -40,6 +40,14 @@ class Task(models.Model): recursive=True, ) + subtask_non_billable_effective_hours = fields.Float( + compute="_compute_subtask_non_billable_effective_hours", + string="Subtask Non Billable Effective Hours", + store=True, + compute_sudo=True, + recursive=True, + ) + @api.depends('timesheet_ids.unit_amount') def _compute_billable_effective_hours(self): if not any(self._ids): @@ -47,10 +55,10 @@ class Task(models.Model): filtered_timesheets = task.timesheet_ids.filtered(lambda t: not t.exclude_from_sale_order) task.billable_effective_hours = sum(filtered_timesheets.mapped('unit_amount')) return - + timesheet_read_group = self.env['account.analytic.line'].read_group( [('task_id', 'in', self.ids), ('exclude_from_sale_order', '=', False)], # We exclude the lines (timesheet) which are excluded from billing - ['unit_amount', 'task_id'], + ['unit_amount', 'task_id'], ['task_id'] ) @@ -68,12 +76,16 @@ class Task(models.Model): for task in self: task.billable_remaining_hours = task.planned_hours - task.billable_effective_hours - task.subtask_billable_effective_hours - @api.depends('child_ids.billable_effective_hours', 'child_ids.subtask_billable_effective_hours') def _compute_subtask_billable_effective_hours(self): for task in self: task.subtask_billable_effective_hours = sum(child_task.billable_effective_hours + child_task.subtask_billable_effective_hours for child_task in task.child_ids) + @api.depends('child_ids.billable_effective_hours', 'child_ids.subtask_billable_effective_hours') + def _compute_subtask_non_billable_effective_hours(self): + for task in self: + task.subtask_non_billable_effective_hours = sum(child_task.non_billable_effective_hours + child_task.subtask_non_billable_effective_hours for child_task in task.child_ids) + @api.depends('billable_effective_hours', 'subtask_billable_effective_hours', 'planned_hours') def _compute_billable_progress_hours(self): for task in self: @@ -84,4 +96,4 @@ class Task(models.Model): else: task.billable_progress = round(100.0 * task_total_hours / task.planned_hours, 2) else: - task.billable_progress = 0.0 \ No newline at end of file + task.billable_progress = 0.0 diff --git a/project_working_time_task_portal/views/hr_timesheet_view_task_form2.xml b/project_working_time_task_portal/views/hr_timesheet_view_task_form2.xml index 53141a4..b9f382c 100644 --- a/project_working_time_task_portal/views/hr_timesheet_view_task_form2.xml +++ b/project_working_time_task_portal/views/hr_timesheet_view_task_form2.xml @@ -19,14 +19,28 @@ + + + + + + + + - - + - \ No newline at end of file +