From a1268c15eb229564ed16ce13fddd91d9656d56d5 Mon Sep 17 00:00:00 2001 From: jem-odoo Date: Tue, 17 Sep 2019 12:09:19 +0000 Subject: [PATCH] [FIX] hr_timesheet: employee in the same company as the timesheet When encoding a timesheet, we want it to be linked to an employee of the same company. Purpose is for the current user to find its correct employee directly, and so its timesheet cost. Task-1999686 --- addons/hr_timesheet/models/hr_timesheet.py | 2 +- addons/hr_timesheet/views/hr_timesheet_views.xml | 2 ++ addons/hr_timesheet/views/project_views.xml | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/hr_timesheet/models/hr_timesheet.py b/addons/hr_timesheet/models/hr_timesheet.py index 151959944c5..4fa6786a729 100644 --- a/addons/hr_timesheet/models/hr_timesheet.py +++ b/addons/hr_timesheet/models/hr_timesheet.py @@ -23,7 +23,7 @@ class AccountAnalyticLine(models.Model): task_id = fields.Many2one('project.task', 'Task', index=True, domain="[('company_id', '=', company_id)]") project_id = fields.Many2one('project.project', 'Project', domain=[('allow_timesheets', '=', True)]) - employee_id = fields.Many2one('hr.employee', "Employee") + employee_id = fields.Many2one('hr.employee', "Employee", check_company=True) department_id = fields.Many2one('hr.department', "Department", compute='_compute_department_id', store=True, compute_sudo=True) encoding_uom_id = fields.Many2one('uom.uom', compute='_compute_encoding_uom_id') diff --git a/addons/hr_timesheet/views/hr_timesheet_views.xml b/addons/hr_timesheet/views/hr_timesheet_views.xml index 6f5b16b7181..e1be7846aad 100644 --- a/addons/hr_timesheet/views/hr_timesheet_views.xml +++ b/addons/hr_timesheet/views/hr_timesheet_views.xml @@ -27,6 +27,7 @@ + @@ -41,6 +42,7 @@ + diff --git a/addons/hr_timesheet/views/project_views.xml b/addons/hr_timesheet/views/project_views.xml index cbafa431f03..de2c9365aff 100644 --- a/addons/hr_timesheet/views/project_views.xml +++ b/addons/hr_timesheet/views/project_views.xml @@ -94,6 +94,7 @@ + @@ -136,6 +137,7 @@ +