Skip to content

Commit

Permalink
Merge pull request #3032 from ONE-F-M/186777992
Browse files Browse the repository at this point in the history
Fix: employee_master_role
  • Loading branch information
mymi14s authored Jan 4, 2024
2 parents f87265c + 3c450c6 commit a994e45
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions one_fm/overrides/employee.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,11 @@ def validate_employee_status_access(self):
def is_employee_master(user:str) -> int:
#Return 1 if the employee has the required roles to modify the employee form.
can_edit = 0
employee_setting = frappe.get_doc("ONEFM General Setting").get("employee_master_role")
if employee_setting:
roles = [i.role for i in employee_setting]
employee_master_role = frappe.get_doc("ONEFM General Setting").get("employee_master_role")
if employee_master_role:
user_roles = frappe.get_roles(user)
for each in roles:
if each in user_roles:
return 1
if employee_master_role in user_roles:
return 1
return can_edit


Expand Down

0 comments on commit a994e45

Please sign in to comment.