From b1979049d8873ea89876adcf2a4d861e0b16ea94 Mon Sep 17 00:00:00 2001 From: Florian Mounier Date: Mon, 12 Feb 2024 16:38:39 +0100 Subject: [PATCH] [ADD] projectt_workload_timesheet_additions --- .../__init__.py | 1 + .../__manifest__.py | 17 +++++++++++++ .../models/__init__.py | 2 ++ .../models/hr_timesheet_sheet.py | 8 ++++++ .../models/project_workload_unit.py | 25 +++++++++++++++++++ .../views/hr_timesheet_sheet_views.xml | 12 +++++++++ 6 files changed, 65 insertions(+) create mode 100644 project_workload_timesheet_additions/__init__.py create mode 100644 project_workload_timesheet_additions/__manifest__.py create mode 100644 project_workload_timesheet_additions/models/__init__.py create mode 100644 project_workload_timesheet_additions/models/hr_timesheet_sheet.py create mode 100644 project_workload_timesheet_additions/models/project_workload_unit.py create mode 100644 project_workload_timesheet_additions/views/hr_timesheet_sheet_views.xml diff --git a/project_workload_timesheet_additions/__init__.py b/project_workload_timesheet_additions/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/project_workload_timesheet_additions/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/project_workload_timesheet_additions/__manifest__.py b/project_workload_timesheet_additions/__manifest__.py new file mode 100644 index 000000000..2682ddf42 --- /dev/null +++ b/project_workload_timesheet_additions/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2024 Akretion (https://www.akretion.com). +# @author Florian Mounier +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Project Workload Timesheet Additions", + "summary": "Add Workload Additions To Timesheets", + "version": "14.0.1.0.0", + "development_status": "Alpha", + "category": "Uncategorized", + "website": "https://github.com/akretion/ak-odoo-incubator", + "author": " Akretion", + "license": "AGPL-3", + "depends": ["project_workload_additions", "project_workload_timesheet"], + "data": ["views/hr_timesheet_sheet_views.xml"], + "auto_install": True, +} diff --git a/project_workload_timesheet_additions/models/__init__.py b/project_workload_timesheet_additions/models/__init__.py new file mode 100644 index 000000000..ef599bd60 --- /dev/null +++ b/project_workload_timesheet_additions/models/__init__.py @@ -0,0 +1,2 @@ +from . import hr_timesheet_sheet +from . import project_workload_unit diff --git a/project_workload_timesheet_additions/models/hr_timesheet_sheet.py b/project_workload_timesheet_additions/models/hr_timesheet_sheet.py new file mode 100644 index 000000000..b9bcd8b40 --- /dev/null +++ b/project_workload_timesheet_additions/models/hr_timesheet_sheet.py @@ -0,0 +1,8 @@ +# Copyright 2024 Akretion (https://www.akretion.com). +# @author Florian Mounier +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import api, fields, models + + +class Sheet(models.Model): + _inherit = "hr_timesheet.sheet" diff --git a/project_workload_timesheet_additions/models/project_workload_unit.py b/project_workload_timesheet_additions/models/project_workload_unit.py new file mode 100644 index 000000000..c793b2b8b --- /dev/null +++ b/project_workload_timesheet_additions/models/project_workload_unit.py @@ -0,0 +1,25 @@ +# Copyright 2024 Akretion (https://www.akretion.com). +# @author Florian Mounier +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ProjectWorkloadUnit(models.Model): + _inherit = "project.workload.unit" + additional_workload_id = fields.Many2one( + "project.task.workload.addition", + "Additional Task Workload", + related="workload_id.additional_workload_id", + ) + additional_task_id = fields.Many2one( + "project.task", + "Additional Task", + related="workload_id.additional_workload_task_id", + ) + + def _get_timesheeting_task(self): + # Timesheet in additional workload task + if self.additional_workload_id: + return self.additional_task_id + return super()._get_timesheeting_task() diff --git a/project_workload_timesheet_additions/views/hr_timesheet_sheet_views.xml b/project_workload_timesheet_additions/views/hr_timesheet_sheet_views.xml new file mode 100644 index 000000000..09c7d84b9 --- /dev/null +++ b/project_workload_timesheet_additions/views/hr_timesheet_sheet_views.xml @@ -0,0 +1,12 @@ + + + + hr_timesheet.sheet + + + + + + + +