[fix] [communication] [minor] set lead and contact

This commit is contained in:
Anand Doshi 2013-08-30 11:13:43 +05:30
parent b330307b45
commit ecc14fd77f

View file

@ -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]},