mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-04 20:59:11 +00:00
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:
@@ -38,6 +38,9 @@ frappe.ui.form.on("Leave Application", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
validate: function(frm) {
|
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);
|
frm.toggle_reqd("half_day_date", frm.doc.half_day == 1);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ class LeaveApplication(Document):
|
|||||||
self.validate_block_days()
|
self.validate_block_days()
|
||||||
self.validate_salary_processed_days()
|
self.validate_salary_processed_days()
|
||||||
self.validate_attendance()
|
self.validate_attendance()
|
||||||
|
self.set_half_day_date()
|
||||||
if frappe.db.get_value("Leave Type", self.leave_type, 'is_optional_leave'):
|
if frappe.db.get_value("Leave Type", self.leave_type, 'is_optional_leave'):
|
||||||
self.validate_optional_leave()
|
self.validate_optional_leave()
|
||||||
self.validate_applicable_after()
|
self.validate_applicable_after()
|
||||||
@@ -292,6 +293,10 @@ class LeaveApplication(Document):
|
|||||||
frappe.throw(_("{0} is not in Optional Holiday List").format(formatdate(day)), NotAnOptionalHoliday)
|
frappe.throw(_("{0} is not in Optional Holiday List").format(formatdate(day)), NotAnOptionalHoliday)
|
||||||
day = add_days(day, 1)
|
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):
|
def notify_employee(self):
|
||||||
employee = frappe.get_doc("Employee", self.employee)
|
employee = frappe.get_doc("Employee", self.employee)
|
||||||
if not employee.user_id:
|
if not employee.user_id:
|
||||||
|
|||||||
Reference in New Issue
Block a user