diff --git a/addons/hr_timesheet/models/project.py b/addons/hr_timesheet/models/project.py index 89962337715..5271b6fd8b7 100644 --- a/addons/hr_timesheet/models/project.py +++ b/addons/hr_timesheet/models/project.py @@ -183,6 +183,16 @@ class Project(models.Model): project._create_analytic_account() return super(Project, self).write(values) + def name_get(self): + res = super().name_get() + if len(self.env.context.get('allowed_company_ids', [])) <= 1: + return res + name_mapping = dict(res) + for project in self: + if project.is_internal_project: + name_mapping[project.id] = f'{name_mapping[project.id]} - {project.company_id.name}' + return list(name_mapping.items()) + @api.model def _init_data_analytic_account(self): self.search([('analytic_account_id', '=', False), ('allow_timesheets', '=', True)])._create_analytic_account() diff --git a/addons/hr_timesheet/models/res_company.py b/addons/hr_timesheet/models/res_company.py index de1ba261311..888c8ae7225 100644 --- a/addons/hr_timesheet/models/res_company.py +++ b/addons/hr_timesheet/models/res_company.py @@ -61,7 +61,7 @@ class ResCompany(models.Model): for company in self: company = company.with_company(company) results += [{ - 'name': _('Internal - %s', company.name), + 'name': _('Internal'), 'allow_timesheets': True, 'company_id': company.id, 'type_ids': type_ids, diff --git a/addons/project/views/project_views.xml b/addons/project/views/project_views.xml index 1a8b2b1f9f3..91317a6f3f6 100644 --- a/addons/project/views/project_views.xml +++ b/addons/project/views/project_views.xml @@ -551,7 +551,7 @@ - + @@ -648,7 +648,7 @@ project.project - + @@ -677,7 +677,7 @@
- +