Only show the data in listview that is connected through doctypes

Hello,

I’ve created 2 doctypes of vendors and employers and some of the vendors are connected to some employers and vice versa. So when the vendor opens the employers doctype then he can only able to see the employers that are connected to him and the same in the case of employers. When they open vendors doctype then they can only able to see vendors that are connected to them.

So how can I manage the relationship between them and achieve the above requirement?

Thanks

Hi @erpnxt_user,

So you can set Only If Creator in Role Permission Manager.

Please set a particular role to define in the user and then checked.
If user-A creates a new vendor then will be only the user-A-created vendor show only and the same as in the employee case.

Thank You!

Hi @NCP

Actually, I’ve a list already available for the two doctypes Vendors and Employers

and I want to add a relationship between them so when a vendor-01 is related to Employer-01 and Employer-02 then he can only be able to see Employer-01 & 02, not the third one.

Both vendors and employers are created by admin so I think assigning role permission that you have suggested will not work

Thanks

Hi @erpnxt_user,
First, tell me that has an employee user?

Thanks.

No, I’ve created separate roles for them and currently they have access to vendors and employers doctypes only that I’ve mentioned in earlier post

if the vendor has not had a user then how can you set rights for employees.

In the same case if an employee has not had a user then how can you set rights for a vendor.

Otherwise, I think in your case first link with the user both doctype but i am not sure how to work both side role permission.

Hope you can try the best level.

Thank You!

Hi @NCP

Both are the user itself and are linked with both vendor and employers doctypes and I’ve also given permission to read doctypes to them.

The thing is vendor can see all the employers and employers can see all the vendors. So I just have to restrict them to see only those who are linked to them. That’s why I have to find out how to implement relation between them and put a condition in a listview to restrict them.

Thanks

This should be solved with user permissions:

https://docs.erpnext.com/docs/v13/user/manual/en/setting-up/users-and-permissions/user-permissions

Once you’ve defined a relationship between the vendor and employee (using a link field), you should be able to apply permissions on top of it.

1 Like