fix: full day leaves not tagged as half day in attendance (#20487)

* fix: full day leaves not tagged as half day in attendance

* chore: code cleanup for half day date value set
This commit is contained in:
Parth J. Kharwar 2020-02-05 15:01:13 +05:30 committed by GitHub
parent f639e363d6
commit 830b316543
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -104,11 +104,16 @@ frappe.ui.form.on("Leave Application", {
},
half_day: function(frm) {
if (frm.doc.from_date == frm.doc.to_date) {
frm.set_value("half_day_date", frm.doc.from_date);
if (frm.doc.half_day) {
if (frm.doc.from_date == frm.doc.to_date) {
frm.set_value("half_day_date", frm.doc.from_date);
}
else {
frm.trigger("half_day_datepicker");
}
}
else {
frm.trigger("half_day_datepicker");
frm.set_value("half_day_date", "");
}
frm.trigger("calculate_total_days");
},