-
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_additions: Improve naming
- Loading branch information
1 parent
31ed221
commit f70d849
Showing
2 changed files
with
22 additions
and
0 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,5 +1,6 @@ | ||
from . import project_project | ||
from . import project_task_workload | ||
from . import project_workload_unit | ||
from . import project_task | ||
from . import project_task_workload_addition_type | ||
from . import project_task_workload_addition |
21 changes: 21 additions & 0 deletions
21
project_workload_additions/models/project_workload_unit.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,21 @@ | ||
# Copyright 2024 Akretion (https://www.akretion.com). | ||
# @author Sébastien BEAU <[email protected]> | ||
# @author Florian Mounier <[email protected]> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import _, models | ||
|
||
|
||
class ProjectWorkloadUnit(models.Model): | ||
_inherit = "project.workload.unit" | ||
|
||
def name_get(self): | ||
result = super().name_get() | ||
units_names = dict(result) | ||
for unit_id, name in result: | ||
unit = self.browse(unit_id) | ||
if unit.workload_id.additional_workload_id: | ||
name = f"{unit.workload_id.additional_workload_id.task_id.name} {_('of')} {name}" | ||
units_names[unit_id] = name | ||
|
||
return list(units_names.items()) |