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:
rohitwaghchaure 2020-07-08 12:40:30 +05:30 committed by GitHub
commit be9f8dc5db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 = "";
}
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)