From 9e8e498240cb7254d4b6fc91cc292b8acdf78644 Mon Sep 17 00:00:00 2001 From: "pawan.sharma" Date: Thu, 9 Dec 2021 17:06:37 +0530 Subject: [PATCH] update code for timesheet modification permission --- cor_custom/models/analytic.py | 12 ++++++++---- cor_custom/views/res_users.xml | 27 +++++++++++++++------------ 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/cor_custom/models/analytic.py b/cor_custom/models/analytic.py index 422f57a..e33be56 100755 --- a/cor_custom/models/analytic.py +++ b/cor_custom/models/analytic.py @@ -140,10 +140,14 @@ class AccountAnalyticLine(models.Model): user_ids = self.env['hr.employee'].search( [('user_id', 'in', self.project_id.allowed_internal_user_ids.ids)]).ids project_all_emp_ids = cuser + manager_id + user_ids + consul_project_ids - result = { - #'domain': {'task_id': domain, 'employee_id': [('id', 'in', project_all_emp_ids)]}, - 'domain': {'task_id': domain, 'employee_id': [('id', 'in', project_all_emp_ids)]}, - } + if self.env.user.timesheet_create == True: + result = { + 'domain': {'task_id': domain}, + } + else: + result = { + 'domain': {'task_id': domain, 'employee_id': [('id', 'in', project_all_emp_ids)]}, + } if self.project_id != self.task_id.project_id: # reset task when changing project self.task_id = False diff --git a/cor_custom/views/res_users.xml b/cor_custom/views/res_users.xml index 1517ac9..bb8727d 100755 --- a/cor_custom/views/res_users.xml +++ b/cor_custom/views/res_users.xml @@ -1,15 +1,18 @@ - - + + - - res.users - - - - - - - - + + res.users + + + + + + + + + + + \ No newline at end of file