Skip to content

Commit

Permalink
[IMP] project_workload_additions: Improve naming
Browse files Browse the repository at this point in the history
  • Loading branch information
paradoxxxzero committed Feb 15, 2024
1 parent 31ed221 commit f70d849
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions project_workload_additions/models/__init__.py
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 project_workload_additions/models/project_workload_unit.py
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())

0 comments on commit f70d849

Please sign in to comment.