diff --git a/core/doctype/communication/communication.py b/core/doctype/communication/communication.py index f4e2aafb87..e4c28f0a02 100644 --- a/core/doctype/communication/communication.py +++ b/core/doctype/communication/communication.py @@ -35,6 +35,7 @@ class DocType(): else: parent.doc.status = "Open" + parent.ignore_permissions = True parent.save() @@ -136,10 +137,14 @@ def send_comm_email(d, name, sent_via=None, print_html=None, attachments='[]', s if sent_via and hasattr(sent_via, 'on_communication_sent'): sent_via.on_communication_sent(d) - + def set_lead_and_contact(d): import email.utils email_addr = email.utils.parseaddr(d.sender) + + if webnotes.conn.get_value("Profile", email_addr[1], "user_type")=="System User": + email_addr = email.utils.parseaddr(d.recipients) + # set contact if not d.contact: d.contact = webnotes.conn.get_value("Contact", {"email_id": email_addr[1]},