mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-03 04:09:11 +00:00
[fix] unique employee id validation for sales person
This commit is contained in:
@@ -29,5 +29,7 @@ class SalesPerson(NestedSet):
|
|||||||
return frappe.db.get_value("User", user, "email") or user
|
return frappe.db.get_value("User", user, "email") or user
|
||||||
|
|
||||||
def validate_employee_id(self):
|
def validate_employee_id(self):
|
||||||
if frappe.db.exists({"doctype": "Sales Person","employee": self.employee}):
|
sales_person = frappe.db.get_value("Sales Person", {"employee": self.employee})
|
||||||
frappe.throw("Another sales person with the same employee id exists.", frappe.DuplicateEntryError)
|
|
||||||
|
if sales_person and sales_person != self.name:
|
||||||
|
frappe.throw(_("Another sales person {0} exists with the same employee id").format(sales_person))
|
||||||
|
|||||||
Reference in New Issue
Block a user