[minor] check if joining date is available before validating attandance date
This commit is contained in:
parent
d7de3c606b
commit
5123a8519b
@ -35,9 +35,11 @@ class Attendance(Document):
|
|||||||
frappe.throw(_("No leave record found for employee {0} for {1}").format(self.employee, self.attendance_date))
|
frappe.throw(_("No leave record found for employee {0} for {1}").format(self.employee, self.attendance_date))
|
||||||
|
|
||||||
def validate_attendance_date(self):
|
def validate_attendance_date(self):
|
||||||
|
date_of_joining = frappe.db.get_value("Employee", self.employee, "date_of_joining")
|
||||||
|
|
||||||
if getdate(self.attendance_date) > getdate(nowdate()):
|
if getdate(self.attendance_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.attendance_date) < frappe.db.get_value("Employee", self.employee, "date_of_joining"):
|
elif date_of_joining and getdate(self.attendance_date) < getdate(date_of_joining):
|
||||||
frappe.throw(_("Attendance date can not be less than employee's joining date"))
|
frappe.throw(_("Attendance date can not be less than employee's joining date"))
|
||||||
|
|
||||||
def validate_employee(self):
|
def validate_employee(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user