fix: Exclude current record while validating duplicate employee

This commit is contained in:
Nabin Hait 2019-12-24 18:06:49 +05:30 committed by GitHub
parent e57f1c995d
commit 0d9c151d9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,7 +27,7 @@ class Instructor(Document):
self.validate_duplicate_employee() self.validate_duplicate_employee()
def validate_duplicate_employee(self): def validate_duplicate_employee(self):
if self.employee and frappe.db.get_value("Instructor", {'employee': self.employee}, 'name'): if self.employee and frappe.db.get_value("Instructor", {'employee': self.employee, 'name': ['!=', self.name]}, 'name'):
frappe.throw(_("Employee ID is linked with another instructor")) frappe.throw(_("Employee ID is linked with another instructor"))