mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-27 08:54:45 +00:00
Attendance - Unique check based on Employee and Date excluding cancelled docs (#15556)
This commit is contained in:
@@ -13,7 +13,7 @@ from frappe.utils import cstr
|
|||||||
class Attendance(Document):
|
class Attendance(Document):
|
||||||
def validate_duplicate_record(self):
|
def validate_duplicate_record(self):
|
||||||
res = frappe.db.sql("""select name from `tabAttendance` where employee = %s and attendance_date = %s
|
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))
|
(self.employee, self.attendance_date, self.name))
|
||||||
if res:
|
if res:
|
||||||
frappe.throw(_("Attendance for employee {0} is already marked").format(self.employee))
|
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
|
"docstatus": d.docstatus
|
||||||
}
|
}
|
||||||
if e not in events:
|
if e not in events:
|
||||||
events.append(e)
|
events.append(e)
|
||||||
|
|||||||
Reference in New Issue
Block a user