[minor] check employee date of joining before marking the employee attendance

This commit is contained in:
mbauskar 2017-03-29 18:40:42 +05:30 committed by Nabin Hait
parent de98ff6bb9
commit 07e6bdd4f2

View File

@ -32,6 +32,8 @@ class Attendance(Document):
def validate_att_date(self): def validate_att_date(self):
if getdate(self.att_date) > getdate(nowdate()): if getdate(self.att_date) > getdate(nowdate()):
frappe.throw(_("Attendance can not be marked for future dates")) frappe.throw(_("Attendance can not be marked for future dates"))
elif getdate(self.att_date) < frappe.db.get_value("Employee", self.employee, "date_of_joining"):
frappe.throw(_("Attendance date can not be less than employee's joining date"))
def validate_employee(self): def validate_employee(self):
emp = frappe.db.sql("select name from `tabEmployee` where name = %s and status = 'Active'", emp = frappe.db.sql("select name from `tabEmployee` where name = %s and status = 'Active'",