Hi there,
I am currently customizing the projects DocType. I want that the customer is only visible to manager level. Hence I moved it to Permlevel 2 and only give this role access to it.
However, employees should still be able to edit the document. However, if the employee saves the document ERPNext complains that customer is a mandatory field an should filled.
The problem is: the manager already filled it and it should not complain?
Any help would be so much appreaciated! Thanks a lot!
I “think” this should work.
- Customize the ‘Project’
- Scroll down until you find the ‘Customer’ DocField. Click
Edit
- Find the checkbox “Ignore User Permissions”, and mark it.
What this should do is allow anyone to select a Customer on the Project.
However, only your managers could navigate to the main Customer document, and view all the details (name, address, phone, etc.)
try this simple client form script.
maybe it can be handled in form.save.js as a framework level solution.
frappe.ui.form.on('Project', {
before_save(frm) {
if (!frappe.perm.has_perm(frm.doctype, 2, 'read') && !frm.is_new()) {
frm.set_df_property('customer', 'reqd', 0)
}
}
})
1 Like
Thank you Brian! That does not solve this issue but helped me alot with another issue 
Thanks that did it! Great advise.