mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-19 17:45:04 +00:00
validation added to check if multiple sales person have been given the same employee id
This commit is contained in:
@@ -14,6 +14,7 @@ class SalesPerson(NestedSet):
|
||||
for d in self.get('targets') or []:
|
||||
if not flt(d.target_qty) and not flt(d.target_amount):
|
||||
frappe.throw(_("Either target qty or target amount is mandatory."))
|
||||
self.validate_employee_id()
|
||||
|
||||
def on_update(self):
|
||||
super(SalesPerson, self).on_update()
|
||||
@@ -26,3 +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 empoyee id exists.")
|
||||
|
||||
Reference in New Issue
Block a user