Leave Approver can see other employee Salary slip

  • let say their are 3 teams in company, each has a team leader, which has give permission of leave approver, every employee under a team leader reports tom him.
    basically i have filled the “reports_to” field in Employee master

  • below is the roles given to team leader(leave approver)

  • when i fill the reports_to field in Employee master, team leader (leave approver) can see the Leave application, Attendance request, Salary slip etc.

  • The problem is i want the team leader to see his Salary slip only, not the employee who are working under him

  • currently i have given user permission to salary slip hardcoded like below

but i want like employee sees only his Salary Slip, leave approver roles should also see his Salary slip only.
Anyone who knows the solution, correct me if i am wrong anywhere
@NCP bro please look once

@avc @rmehta please help, i am stuck in this task, also leave approver is able to approve and submit his own Leave Application.
Leave approver’s reports_to is manager

@Rajat96318 try a user permission with the employee itself , change salary slip with employee

@bahaou can you elaborate more, i am not able to do so

Employee doctype is tree structure.
If user B reports to user A, then user A will have access to user B unless you specify Hide Descendants in their user permission.

here deepak is the TL and the employee_id : HR-EMP-00005 is an employee working under him

but now also the deepak can see this 05 employee’s Salary slip
help where am i wrong

Why are you giving Deepak permission to HR-EMP-00005 on Salary Slip?

Remove all user permission on Deepak and give permission to himself only, with Hide Descendants ticked.

@rtdany10 man did you ever tested this scenario, you just giving an ideal solution which everyone try on first go
the thing which you said, i did that and now the user can see only his data, his “Leave application”, his all thing. What about the people who are working under him, those people Leave Application gone now.

Below is the User Permission

Below is what the User (TL) sees

Below is Leave Application, sees only of him

Does anyone knows the solution
The question is simple, why Leave Approver sees other employee Salary Slip

If you want him to see Leave Application of his subordinates, then add one more user permission for him, specifically for Leave Application without the Hide Descendants checked. Maybe try being less arrogant and learn how user permission work.

@rtdany10 , sorry man, i apologise
Their are many doctype, for which now i have do this, which you are saying for Leave Application, others Doctype like : Attendance request, Attendance, Shift type, Shift assignment, Leave policy, Loan Application, Loan, etc many more
Since their is not only one Team Leader, doing this i think is not a valid approach, do you have any other suggestion

You don’t have any other way to achieve it using User Permission.
You can, however, use the following hook to set permission doctype wise:

  1. permission_query_conditions: Hooks
  2. has_permission: Hooks