Set the guardian role automatically. (#12136)

* Add the guardian role for parent portal

* invite guardian as user
This commit is contained in:
Manas Solanki
2017-12-22 10:50:10 +05:30
committed by Nabin Hait
parent 6401678e63
commit 5807cd8e6f
7 changed files with 99 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
import frappe
def set_default_role(doc, method):
'''Set customer, supplier, student based on email'''
'''Set customer, supplier, student, guardian based on email'''
if frappe.flags.setting_role or frappe.flags.in_migrate:
return
@@ -18,3 +18,5 @@ def set_default_role(doc, method):
doc.add_roles('Supplier')
elif frappe.get_value('Student', dict(student_email_id=doc.email)) and 'Student' not in roles:
doc.add_roles('Student')
elif frappe.get_value('Guardian', dict(email_address=doc.email)) and 'Guardian' not in roles:
doc.add_roles('Guardian')