[minor] ignore email validation if comes from email;
This commit is contained in:
parent
06c92a782a
commit
f2d89987f5
@ -38,7 +38,8 @@ class Lead(SellingController):
|
|||||||
frappe.throw(_("Campaign Name is required"))
|
frappe.throw(_("Campaign Name is required"))
|
||||||
|
|
||||||
if self.email_id:
|
if self.email_id:
|
||||||
validate_email_add(self.email_id, True)
|
if not self.flags.ignore_email_validation:
|
||||||
|
validate_email_add(self.email_id, True)
|
||||||
|
|
||||||
if self.email_id == self.lead_owner:
|
if self.email_id == self.lead_owner:
|
||||||
# Lead Owner cannot be same as the Lead
|
# Lead Owner cannot be same as the Lead
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe, json
|
import frappe, json
|
||||||
from frappe.utils import cstr, cint, get_fullname, validate_email_add
|
from frappe.utils import cstr, cint, get_fullname
|
||||||
from frappe import msgprint, _
|
from frappe import msgprint, _
|
||||||
from frappe.model.mapper import get_mapped_doc
|
from frappe.model.mapper import get_mapped_doc
|
||||||
from erpnext.setup.utils import get_exchange_rate
|
from erpnext.setup.utils import get_exchange_rate
|
||||||
@ -43,7 +43,7 @@ class Opportunity(TransactionBase):
|
|||||||
|
|
||||||
def make_new_lead_if_required(self):
|
def make_new_lead_if_required(self):
|
||||||
"""Set lead against new opportunity"""
|
"""Set lead against new opportunity"""
|
||||||
if not (self.lead or self.customer) and self.contact_email and validate_email_add(self.contact_email):
|
if not (self.lead or self.customer) and self.contact_email:
|
||||||
lead_name = frappe.db.get_value("Lead", {"email_id": self.contact_email})
|
lead_name = frappe.db.get_value("Lead", {"email_id": self.contact_email})
|
||||||
if not lead_name:
|
if not lead_name:
|
||||||
sender_name = get_fullname(self.contact_email)
|
sender_name = get_fullname(self.contact_email)
|
||||||
@ -64,6 +64,7 @@ class Opportunity(TransactionBase):
|
|||||||
"lead_name": sender_name
|
"lead_name": sender_name
|
||||||
})
|
})
|
||||||
|
|
||||||
|
lead.flags.ignore_email_validation = True
|
||||||
lead.insert(ignore_permissions=True)
|
lead.insert(ignore_permissions=True)
|
||||||
lead_name = lead.name
|
lead_name = lead.name
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user