Is it possible to restrict access for Supervisor 1 & 2 to their Sale Persons only and Manager to see his child sales data only?
@Shivam.thaker yes, it’s fully possible!
But not without customizations!
You will need to create some query_permissions
and has_permissions
hooks into a custom app.
Frappe by default implement a plenty of those!
You can take a look into they
here
"frappe.core.doctype.activity_log.feed.login_feed",
"frappe.core.doctype.user.user.notify_admin_access_to_system_manager",
]
on_logout = (
"frappe.core.doctype.session_default_settings.session_default_settings.clear_session_defaults"
)
# permissions
permission_query_conditions = {
"Event": "frappe.desk.doctype.event.event.get_permission_query_conditions",
"ToDo": "frappe.desk.doctype.todo.todo.get_permission_query_conditions",
"User": "frappe.core.doctype.user.user.get_permission_query_conditions",
"Dashboard Settings": "frappe.desk.doctype.dashboard_settings.dashboard_settings.get_permission_query_conditions",
"Notification Log": "frappe.desk.doctype.notification_log.notification_log.get_permission_query_conditions",
"Dashboard": "frappe.desk.doctype.dashboard.dashboard.get_permission_query_conditions",
"Dashboard Chart": "frappe.desk.doctype.dashboard_chart.dashboard_chart.get_permission_query_conditions",
"Number Card": "frappe.desk.doctype.number_card.number_card.get_permission_query_conditions",
"Notification Settings": "frappe.desk.doctype.notification_settings.notification_settings.get_permission_query_conditions",
"Note": "frappe.desk.doctype.note.note.get_permission_query_conditions",
and here
"Notification Settings": "frappe.desk.doctype.notification_settings.notification_settings.get_permission_query_conditions",
"Note": "frappe.desk.doctype.note.note.get_permission_query_conditions",
"Kanban Board": "frappe.desk.doctype.kanban_board.kanban_board.get_permission_query_conditions",
"Contact": "frappe.contacts.address_and_contact.get_permission_query_conditions_for_contact",
"Address": "frappe.contacts.address_and_contact.get_permission_query_conditions_for_address",
"Communication": "frappe.core.doctype.communication.communication.get_permission_query_conditions_for_communication",
"Workflow Action": "frappe.workflow.doctype.workflow_action.workflow_action.get_permission_query_conditions",
"Prepared Report": "frappe.core.doctype.prepared_report.prepared_report.get_permission_query_condition",
}
has_permission = {
"Event": "frappe.desk.doctype.event.event.has_permission",
"ToDo": "frappe.desk.doctype.todo.todo.has_permission",
"User": "frappe.core.doctype.user.user.has_permission",
"Note": "frappe.desk.doctype.note.note.has_permission",
"Dashboard Chart": "frappe.desk.doctype.dashboard_chart.dashboard_chart.has_permission",
"Number Card": "frappe.desk.doctype.number_card.number_card.has_permission",
"Kanban Board": "frappe.desk.doctype.kanban_board.kanban_board.has_permission",
"Contact": "frappe.contacts.address_and_contact.has_permission",
"Address": "frappe.contacts.address_and_contact.has_permission",
"Communication": "frappe.core.doctype.communication.communication.has_permission",
1 Like
Can you explain more how i can do it ?? I am new to frappe
@Shivam.thaker first of all organize your “Sales Team” in the form of a hierarchy.
Sales Team
General Sales Manager
Sales Manager 1
Sales Person 1
Sales Person 2
Sales Person 3
Sales Manager 2
Sales Person 4
Sales Person 5
Sales Person 6
Add a user permission to associate the user with with his respective Sales Person
Add a custom link field on the Lead of type Link associated with the Sales Person doctype.
By default all sales persons only will be able to see what they have as his Sales Person
After to fix the Sales Managers and General Sales Manager permissions you can write the custom app.
To understand how to create custom apps in frappe follow this tutorial
https://frappeframework.com/docs/v13/user/en/tutorial
One alternative to dont use code!
Instead of associate the Sales Managers with they Sales Person, associate they with an Territory.
Also Associate the Sales Persons under the Sales Managers, with that territory.
This will allow the Sales Person, only see they sales.
The Sales Manager to see all the Sales of the Territory
and the General Sales Manager to see everything.
3 Likes