Sent via ERPNext
diff --git a/erpnext/hr/doctype/employee/employee.py b/erpnext/hr/doctype/employee/employee.py
index 4ba3e96cae..5a9bad29dc 100644
--- a/erpnext/hr/doctype/employee/employee.py
+++ b/erpnext/hr/doctype/employee/employee.py
@@ -131,7 +131,7 @@ class Employee(Document):
employee = frappe.db.sql_list("""select name from `tabEmployee` where
user_id=%s and status='Active' and name!=%s""", (self.user_id, self.name))
if employee:
- throw(_("User {0} is already assigned to Employee {1}").format(self.user_id, employee[0]))
+ throw(_("User {0} is already assigned to Employee {1}").format(self.user_id, employee[0]), frappe.DuplicateEntryError)
def validate_employee_leave_approver(self):
for l in self.get("leave_approvers")[:]:
diff --git a/erpnext/setup/doctype/sales_person/sales_person.py b/erpnext/setup/doctype/sales_person/sales_person.py
index 9098aaee27..5f70b23335 100644
--- a/erpnext/setup/doctype/sales_person/sales_person.py
+++ b/erpnext/setup/doctype/sales_person/sales_person.py
@@ -27,7 +27,7 @@ class SalesPerson(NestedSet):
frappe.throw(_("User ID not set for Employee {0}").format(self.employee))
else:
return frappe.db.get_value("User", user, "email") or user
-
+
def validate_employee_id(self):
if frappe.db.exists({"doctype": "Sales Person","employee": self.employee}):
- frappe.throw("Another sales person with the same employee id exists.")
+ frappe.throw("Another sales person with the same employee id exists.", frappe.DuplicateEntryError)