[fix] stop recursion while adding role
diff --git a/erpnext/utilities/address_and_contact.py b/erpnext/utilities/address_and_contact.py
index f3435ae..12ceb5b 100644
--- a/erpnext/utilities/address_and_contact.py
+++ b/erpnext/utilities/address_and_contact.py
@@ -36,10 +36,13 @@
 
 def set_default_role(doc, method):
 	'''Set customer, supplier, student based on email'''
+	if frappe.flags.setting_role:
+		return
 	contact_name = frappe.get_value('Contact', dict(email_id=doc.email))
 	if contact_name:
 		contact = frappe.get_doc('Contact', contact_name)
 		for link in contact.links:
+			frappe.flags.setting_role = True
 			if link.link_doctype=='Customer':
 				doc.add_roles('Customer')
 			elif link.link_doctype=='Supplier':