From 7294c377db3560ef7d57108aad85fb1240d8633a Mon Sep 17 00:00:00 2001 From: Geoffroy Larue Date: Thu, 5 Sep 2019 12:04:30 +0000 Subject: [PATCH] [IMP] hr_timesheet: access logic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix various incoherences related to timesheets : - Hide the progress field on the task form view if user hasn't - timesheet user access. Remove the possibility to link a new timesheet to a task belonging to a project not allowing timesheets. Task-2066533 closes odoo/odoo#36475 Signed-off-by: Jérome Maes (jem) --- addons/hr_timesheet/models/hr_timesheet.py | 4 ++++ addons/hr_timesheet/views/project_views.xml | 2 +- 2 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 84354c64f7a..151959944c5 100644 --- a/addons/hr_timesheet/models/hr_timesheet.py +++ b/addons/hr_timesheet/models/hr_timesheet.py @@ -41,6 +41,10 @@ class AccountAnalyticLine(models.Model): return {'domain': { 'task_id': [('project_id', '=', self.project_id.id)] }} + return {'domain': { + 'task_id': [('project_id.allow_timesheets', '=', True)] + }} + @api.onchange('task_id') def _onchange_task_id(self): diff --git a/addons/hr_timesheet/views/project_views.xml b/addons/hr_timesheet/views/project_views.xml index c8d46bbaa01..cbafa431f03 100644 --- a/addons/hr_timesheet/views/project_views.xml +++ b/addons/hr_timesheet/views/project_views.xml @@ -162,7 +162,7 @@ - +