[fix] stop recursion while adding role
This commit is contained in:
parent
982be9f11b
commit
d14a6c058a
@ -36,10 +36,13 @@ def load_address_and_contact(doc, key):
|
||||
|
||||
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':
|
||||
|
Loading…
x
Reference in New Issue
Block a user