fix: set half day date None if half day is unchecked

This commit is contained in:
Anurag Mishra 2020-06-30 12:11:03 +05:30
parent 73edba0e10
commit 8f2cb0beb6
2 changed files with 4 additions and 0 deletions

View File

@ -40,6 +40,8 @@ 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;
}else if (frm.doc.half_day == 0){
frm.doc.half_day_date = undefined;
}
frm.toggle_reqd("half_day_date", frm.doc.half_day == 1);
},

View File

@ -293,6 +293,8 @@ class LeaveApplication(Document):
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
elif self.half_day == 0:
self.half_day_date = None
def notify_employee(self):
employee = frappe.get_doc("Employee", self.employee)