fix(HR): Fix half day error when only 1 day is selected (#22122)
* fix half day error when only 1 day is selected * adding validation fix for half day on serverside
This commit is contained in:
parent
407c7bc113
commit
328a55749d
@ -38,6 +38,9 @@ frappe.ui.form.on("Leave Application", {
|
||||
},
|
||||
|
||||
validate: function(frm) {
|
||||
if (frm.doc.from_date == frm.doc.to_date && frm.doc.half_day == 1){
|
||||
frm.doc.half_day_date = frm.doc.from_date;
|
||||
}
|
||||
frm.toggle_reqd("half_day_date", frm.doc.half_day == 1);
|
||||
},
|
||||
|
||||
|
@ -33,6 +33,7 @@ class LeaveApplication(Document):
|
||||
self.validate_block_days()
|
||||
self.validate_salary_processed_days()
|
||||
self.validate_attendance()
|
||||
self.set_half_day_date()
|
||||
if frappe.db.get_value("Leave Type", self.leave_type, 'is_optional_leave'):
|
||||
self.validate_optional_leave()
|
||||
self.validate_applicable_after()
|
||||
@ -292,6 +293,10 @@ class LeaveApplication(Document):
|
||||
frappe.throw(_("{0} is not in Optional Holiday List").format(formatdate(day)), NotAnOptionalHoliday)
|
||||
day = add_days(day, 1)
|
||||
|
||||
def set_half_day_date(self):
|
||||
if self.from_date == self.to_date and self.half_day == 1:
|
||||
self.half_day_date = self.from_date
|
||||
|
||||
def notify_employee(self):
|
||||
employee = frappe.get_doc("Employee", self.employee)
|
||||
if not employee.user_id:
|
||||
|
Loading…
Reference in New Issue
Block a user