Merge pull request #16929 from Mangesh-Khairnar/email-address-fix
refactor: change validate email add to validate email address
diff --git a/erpnext/crm/doctype/lead/lead.py b/erpnext/crm/doctype/lead/lead.py
index 29ca71b..442b6c2 100644
--- a/erpnext/crm/doctype/lead/lead.py
+++ b/erpnext/crm/doctype/lead/lead.py
@@ -4,7 +4,7 @@
from __future__ import unicode_literals
import frappe
from frappe import _
-from frappe.utils import (cstr, validate_email_add, cint, comma_and, has_gravatar, now, getdate, nowdate)
+from frappe.utils import (cstr, validate_email_address, cint, comma_and, has_gravatar, now, getdate, nowdate)
from frappe.model.mapper import get_mapped_doc
from erpnext.controllers.selling_controller import SellingController
@@ -38,7 +38,7 @@
if self.email_id:
if not self.flags.ignore_email_validation:
- validate_email_add(self.email_id, True)
+ validate_email_address(self.email_id, True)
if self.email_id == self.lead_owner:
frappe.throw(_("Lead Owner cannot be same as the Lead"))
diff --git a/erpnext/hr/doctype/employee/employee.py b/erpnext/hr/doctype/employee/employee.py
index d518cd8..a403c39 100755
--- a/erpnext/hr/doctype/employee/employee.py
+++ b/erpnext/hr/doctype/employee/employee.py
@@ -4,7 +4,7 @@
from __future__ import unicode_literals
import frappe
-from frappe.utils import getdate, validate_email_add, today, add_years, format_datetime
+from frappe.utils import getdate, validate_email_address, today, add_years, format_datetime
from frappe.model.naming import set_name_by_naming_series
from frappe import throw, _, scrub
from frappe.permissions import add_user_permission, remove_user_permission, \
@@ -142,9 +142,9 @@
def validate_email(self):
if self.company_email:
- validate_email_add(self.company_email, True)
+ validate_email_address(self.company_email, True)
if self.personal_email:
- validate_email_add(self.personal_email, True)
+ validate_email_address(self.personal_email, True)
def validate_status(self):
if self.status == 'Left':
diff --git a/erpnext/hr/doctype/job_applicant/job_applicant.py b/erpnext/hr/doctype/job_applicant/job_applicant.py
index ea81fe7..4fc7719 100644
--- a/erpnext/hr/doctype/job_applicant/job_applicant.py
+++ b/erpnext/hr/doctype/job_applicant/job_applicant.py
@@ -7,7 +7,7 @@
from frappe.model.document import Document
import frappe
from frappe import _
-from frappe.utils import comma_and, validate_email_add
+from frappe.utils import comma_and, validate_email_address
sender_field = "email_id"
@@ -28,7 +28,7 @@
def validate(self):
self.check_email_id_is_unique()
if self.email_id:
- validate_email_add(self.email_id, True)
+ validate_email_address(self.email_id, True)
if not self.applicant_name and self.email_id:
guess = self.email_id.split('@')[0]
diff --git a/erpnext/non_profit/doctype/member/member.py b/erpnext/non_profit/doctype/member/member.py
index b9b2dd8..9afaf90 100644
--- a/erpnext/non_profit/doctype/member/member.py
+++ b/erpnext/non_profit/doctype/member/member.py
@@ -17,5 +17,5 @@
self.validate_email_type(self.email)
def validate_email_type(self, email):
- from frappe.utils import validate_email_add
- validate_email_add(email.strip(), True)
\ No newline at end of file
+ from frappe.utils import validate_email_address
+ validate_email_address(email.strip(), True)
\ No newline at end of file