Browse Source

[bug] Leave application ui issues fixed (#13740)

* validate to_date in leave application

if to_date is less than from_date show message to user
reset to_date value to ''

* var declaration and semicolon missed

* Updated popup message
develop
Shridhar Patil 7 years ago
committed by Nabin Hait
parent
commit
02c93a3d05
  1. 9
      erpnext/hr/doctype/leave_application/leave_application.js

9
erpnext/hr/doctype/leave_application/leave_application.js

@ -110,6 +110,15 @@ frappe.ui.form.on("Leave Application", {
calculate_total_days: function(frm) { calculate_total_days: function(frm) {
if(frm.doc.from_date && frm.doc.to_date && frm.doc.employee && frm.doc.leave_type) { if(frm.doc.from_date && frm.doc.to_date && frm.doc.employee && frm.doc.leave_type) {
var from_date = Date.parse(frm.doc.from_date);
var to_date = Date.parse(frm.doc.to_date);
if(to_date < from_date){
frappe.msgprint(__("To Date cannot be less than From Date"));
frm.set_value('to_date', '');
return;
}
// server call is done to include holidays in leave days calculations // server call is done to include holidays in leave days calculations
return frappe.call({ return frappe.call({
method: 'erpnext.hr.doctype.leave_application.leave_application.get_number_of_leave_days', method: 'erpnext.hr.doctype.leave_application.leave_application.get_number_of_leave_days',

Loading…
Cancel
Save