Skip to content

Commit

Permalink
[ADD] projectt_workload_timesheet_additions
Browse files Browse the repository at this point in the history
  • Loading branch information
paradoxxxzero committed Feb 12, 2024
1 parent c19b902 commit b197904
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 0 deletions.
1 change: 1 addition & 0 deletions project_workload_timesheet_additions/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
17 changes: 17 additions & 0 deletions project_workload_timesheet_additions/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2024 Akretion (https://www.akretion.com).
# @author Florian Mounier <[email protected]>
# 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,
}
2 changes: 2 additions & 0 deletions project_workload_timesheet_additions/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import hr_timesheet_sheet
from . import project_workload_unit
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright 2024 Akretion (https://www.akretion.com).
# @author Florian Mounier <[email protected]>
# 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"
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2024 Akretion (https://www.akretion.com).
# @author Florian Mounier <[email protected]>
# 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()
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="hr_timesheet_sheet_form_my" model="ir.ui.view">
<field name="model">hr_timesheet.sheet</field>
<field name="inherit_id" ref="project_workload_timesheet.hr_timesheet_sheet_form_my" />
<field name="arch" type="xml">
<xpath expr="//field[@name='workload_unit_ids']/tree/field[@name='task_id']" position="after">
<field name="additional_task_id" />
</xpath>
</field>
</record>
</odoo>

0 comments on commit b197904

Please sign in to comment.