mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-21 14:09:19 +00:00
Merge pull request #22522 from Anurag810/leave_application_fixes
fix: set half day date None if half day is unchecked
This commit is contained in:
@@ -40,6 +40,8 @@ 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){
|
if (frm.doc.from_date == frm.doc.to_date && frm.doc.half_day == 1){
|
||||||
frm.doc.half_day_date = frm.doc.from_date;
|
frm.doc.half_day_date = frm.doc.from_date;
|
||||||
|
}else if (frm.doc.half_day == 0){
|
||||||
|
frm.doc.half_day_date = "";
|
||||||
}
|
}
|
||||||
frm.toggle_reqd("half_day_date", frm.doc.half_day == 1);
|
frm.toggle_reqd("half_day_date", frm.doc.half_day == 1);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -293,6 +293,8 @@ class LeaveApplication(Document):
|
|||||||
def set_half_day_date(self):
|
def set_half_day_date(self):
|
||||||
if self.from_date == self.to_date and self.half_day == 1:
|
if self.from_date == self.to_date and self.half_day == 1:
|
||||||
self.half_day_date = self.from_date
|
self.half_day_date = self.from_date
|
||||||
|
elif self.half_day == 0:
|
||||||
|
self.half_day_date = None
|
||||||
|
|
||||||
def notify_employee(self):
|
def notify_employee(self):
|
||||||
employee = frappe.get_doc("Employee", self.employee)
|
employee = frappe.get_doc("Employee", self.employee)
|
||||||
|
|||||||
Reference in New Issue
Block a user