chore: extend default role profiles
This commit is contained in:
parent
930a107af8
commit
0166f69b31
@ -206,13 +206,39 @@ def hide_workspaces():
|
|||||||
|
|
||||||
|
|
||||||
def create_default_role_profiles():
|
def create_default_role_profiles():
|
||||||
for module in ["Accounts", "Stock", "Manufacturing"]:
|
for role_profile_name, roles in DEFAULT_ROLE_PROFILES.items():
|
||||||
create_role_profile(module)
|
role_profile = frappe.new_doc("Role Profile")
|
||||||
|
role_profile.role_profile = role_profile_name
|
||||||
|
for role in roles:
|
||||||
|
role_profile.append("roles", {"role": role})
|
||||||
|
|
||||||
|
role_profile.insert(ignore_permissions=True)
|
||||||
|
|
||||||
|
|
||||||
def create_role_profile(module):
|
DEFAULT_ROLE_PROFILES = {
|
||||||
role_profile = frappe.new_doc("Role Profile")
|
"Inventory": [
|
||||||
role_profile.role_profile = _("{0} User").format(module)
|
"Stock User",
|
||||||
role_profile.append("roles", {"role": module + " User"})
|
"Stock Manager",
|
||||||
role_profile.append("roles", {"role": module + " Manager"})
|
"Item Manager",
|
||||||
role_profile.insert()
|
],
|
||||||
|
"Manufacturing": [
|
||||||
|
"Stock User",
|
||||||
|
"Manufacturing User",
|
||||||
|
"Manufacturing Manager",
|
||||||
|
],
|
||||||
|
"Accounts": [
|
||||||
|
"Accounts User",
|
||||||
|
"Accounts Manager",
|
||||||
|
],
|
||||||
|
"Sales": [
|
||||||
|
"Sales User",
|
||||||
|
"Stock User",
|
||||||
|
"Sales Manager",
|
||||||
|
],
|
||||||
|
"Purchase": [
|
||||||
|
"Item Manager",
|
||||||
|
"Stock User",
|
||||||
|
"Purchase User",
|
||||||
|
"Purchase Manager",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user