From cd385c37350cd4f3fc059d94116eb856f05b6b2d Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Sun, 24 Jul 2016 13:06:08 +0530 Subject: [PATCH] [fix] [minor] email pulling error, via scheduler log --- erpnext/crm/doctype/opportunity/opportunity.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/crm/doctype/opportunity/opportunity.py b/erpnext/crm/doctype/opportunity/opportunity.py index 1e57878df6..79788822a6 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.py +++ b/erpnext/crm/doctype/opportunity/opportunity.py @@ -43,15 +43,15 @@ class Opportunity(TransactionBase): def make_new_lead_if_required(self): """Set lead against new opportunity""" - if not (self.lead or self.customer): + if not (self.lead or self.customer) and self.contact_email: lead_name = frappe.db.get_value("Lead", {"email_id": self.contact_email}) if not lead_name: sender_name = get_fullname(self.contact_email) if sender_name == self.contact_email: sender_name = None - if not sender_name and self.contact_email.index('@'): - email_name = self.contact_email[0:self.contact_email.index('@')] + if not sender_name and ('@' in self.contact_email): + email_name = self.contact_email.split('@')[0] email_split = email_name.split('.') sender_name = ''