fix(HR): validations and bug fixes for Attendance Log
This commit is contained in:
parent
a4d0ba222b
commit
ceea328542
@ -34,6 +34,13 @@ def get_data():
|
||||
"name": "Upload Attendance",
|
||||
"hide_count": True,
|
||||
"dependencies": ["Employee"]
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Employee Attendance Log",
|
||||
"hide_count": True,
|
||||
"onboard": 1,
|
||||
"dependencies": ["Employee"]
|
||||
},
|
||||
]
|
||||
},
|
||||
|
@ -9,7 +9,9 @@ from frappe.model.document import Document
|
||||
from frappe import _
|
||||
|
||||
class EmployeeAttendanceLog(Document):
|
||||
pass
|
||||
def validate(self):
|
||||
if frappe.db.exists('Employee Attendance Log', {'employee': self.employee, 'time': self.time}):
|
||||
frappe.throw('This log already exists for this employee.')
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
@ -37,6 +39,7 @@ def add_log_based_on_biometric_rf_id(biometric_rf_id, timestamp, device_id=None,
|
||||
doc.time = timestamp
|
||||
doc.device_id = device_id
|
||||
doc.log_type = log_type
|
||||
doc.save()
|
||||
doc.insert()
|
||||
frappe.db.commit()
|
||||
|
||||
return doc
|
||||
|
Loading…
x
Reference in New Issue
Block a user