Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions education/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
def after_install():
setup_fixtures()
create_student_role()
create_guardian_role()
create_parent_assessment_group()
create_invoice_permissions()
create_custom_fields(get_custom_fields())
Expand Down Expand Up @@ -42,12 +43,12 @@ def create_parent_assessment_group():

def create_student_role():
if not frappe.db.exists("Role", "Student"):
frappe.get_doc({"doctype": "Role", "role_name": "Student", "desk_access": 0}).save()
frappe.get_doc({"doctype": "Role", "role_name": "Student", "desk_access": 1}).save()


def create_guardian_role():
if not frappe.db.exists("Role", "Guardian"):
frappe.get_doc({"doctype": "Role", "role_name": "Guardian", "desk_access": 0}).save()
frappe.get_doc({"doctype": "Role", "role_name": "Guardian", "desk_access": 1}).save()


def create_invoice_permissions():
Expand Down
1 change: 1 addition & 0 deletions education/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ education.patches.v15_0.create_fee_component_item_group
education.patches.v15_0.create_student_customer_group
education.patches.v15_0.create_custom_permissions
education.patches.v15_0.create_guardian_role
education.patches.v15_0.guardian_invoice_permission
2 changes: 1 addition & 1 deletion education/patches/v15_0/create_guardian_role.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

def execute():
if not frappe.db.exists("Role", "Guardian"):
frappe.get_doc({"doctype": "Role", "role_name": "Guardian", "desk_access": 0}).save()
frappe.get_doc({"doctype": "Role", "role_name": "Guardian", "desk_access": 1}).save()
18 changes: 18 additions & 0 deletions education/patches/v15_0/guardian_invoice_permission.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import frappe

from education.install import create_permissions


def execute():
if not frappe.db.exists("Role", "Guardian"):
return

permissions = [
{
"doctype": "Sales Invoice",
"role": "Guardian",
"permlevel": 0,
"ptype": ["read", "print"],
},
]
create_permissions(permissions)
Loading