-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] project_workload_timesheet_additions: Adapt unit sheet lines re…
…lation for additional loads
- Loading branch information
1 parent
d5e6e6f
commit 8fd9f2b
Showing
4 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from . import account_analytic_line | ||
from . import hr_timesheet_sheet | ||
from . import project_workload_unit |
38 changes: 38 additions & 0 deletions
38
project_workload_timesheet_additions/models/account_analytic_line.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# 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 | ||
from odoo.exceptions import UserError, ValidationError | ||
|
||
|
||
class AccountAnalyticLine(models.Model): | ||
_inherit = "account.analytic.line" | ||
|
||
workload_unit_id = fields.Many2one( | ||
comodel_name="project.workload.unit", | ||
string="Workload Unit", | ||
readonly=False, | ||
compute="_compute_workload_unit_id", | ||
store=True, | ||
domain="[" | ||
"('week', '=', week), " | ||
"('user_id', '=', user_id), " | ||
"('project_id', '=', project_id), " | ||
"'|', " | ||
"'&', ('additional_task_id', '=', False), ('task_id', '=', task_id), " | ||
"('additional_task_id', '=', task_id)" | ||
"]", | ||
) | ||
|
||
def _get_available_workload_units_domain(self): | ||
return [ | ||
("week", "=", self.week), | ||
("user_id", "=", self.user_id.id), | ||
("project_id", "=", self.project_id.id), | ||
"|", | ||
"&", | ||
("additional_task_id", "=", False), | ||
("task_id", "=", self.task_id.id), | ||
("additional_task_id", "=", self.task_id.id), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters