From c0b684dc30d3b139ff4c076e5dbfe3c05010123e Mon Sep 17 00:00:00 2001 From: Sharath C Date: Wed, 3 Oct 2018 10:40:22 +0530 Subject: [PATCH] Attendance - Unique check based on Employee and Date excluding cancelled docs (#15556) --- erpnext/hr/doctype/attendance/attendance.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/hr/doctype/attendance/attendance.py b/erpnext/hr/doctype/attendance/attendance.py index 9f8cea8259..74a53035ad 100644 --- a/erpnext/hr/doctype/attendance/attendance.py +++ b/erpnext/hr/doctype/attendance/attendance.py @@ -13,7 +13,7 @@ from frappe.utils import cstr class Attendance(Document): def validate_duplicate_record(self): res = frappe.db.sql("""select name from `tabAttendance` where employee = %s and attendance_date = %s - and name != %s and docstatus = 1""", + and name != %s and docstatus != 2""", (self.employee, self.attendance_date, self.name)) if res: frappe.throw(_("Attendance for employee {0} is already marked").format(self.employee)) @@ -89,4 +89,4 @@ def add_attendance(events, start, end, conditions=None): "docstatus": d.docstatus } if e not in events: - events.append(e) \ No newline at end of file + events.append(e)