fix(HR): validations and bug fixes for Attendance Log

This commit is contained in:
karthikeyan5 2019-05-12 19:41:34 +05:30
parent a4d0ba222b
commit ceea328542
2 changed files with 13 additions and 3 deletions

View File

@ -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"]
},
]
},

View File

@ -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