i want to hide those recored whose status is draft from others
its should be visible to the employee who is created not to others
i want to hide those recored whose status is draft from others
its should be visible to the employee who is created not to others
u can write permission query for that so set permission query for that using the sql query condition
When creating an Employee, there is a User Permission [sic] document that is created that is used to restrict one user to specific documents.
@Meet i am writing this but its adding in filter and data also not as i am expecting
frappe.listview_settings[âTimesheetâ] = {
onload: function(listview) {
if (!frappe.user.has_role(âSystem Managerâ)) { // System Manager or any role you want to exclude from this filtering
listview.filter_area.add([[listview.doctype, âownerâ, â=â, frappe.session.user]]);
listview.filter_area.add([[listview.doctype, âstatusâ, â!=â, âDraftâ]]);
}
}
};
i want to hide when doc status is draft, it should visible to employee only
There are HUGE security risks in filtering using only JavaScript.
You might want to take a look at the User Permission
and Permission Manager
doctypes/pages.
i want to hide whose status is draft only from others
U can write python function and add in the hooks file for permission query
def timesheet permission(self):
condition = ""
# Write your role condition
if role:
return condition
else:
condition += "doc.status != 0 or doc.owner = self.user"
return condition
@Meet i am unable to create hooks.py file
when i am creating custum app and installing in my site then âno module found errorâ is coming
so i want to try via script
Using from server script try it if your query resolved else use custom app code your condition possible else not possible
@Prashanth_Kolhetkar add this in server script
user = frappe.session.user
employee = frappe.db.get_value(âEmployeeâ,{âuser_idâ:frappe.session.user},ânameâ)
if employee :
conditions = âowner = 'â + user + ââ OR employee= 'â + employee + â'â