From 95984fd921047037c6a83772114af66fd3daa609 Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Fri, 17 Jul 2020 13:02:45 +0530 Subject: [PATCH 1/2] fix: Not able to cancel application,allocation nad encashments --- erpnext/hr/doctype/leave_allocation/leave_allocation.js | 9 ++++++--- .../hr/doctype/leave_application/leave_application.js | 4 ++++ erpnext/hr/doctype/leave_encashment/leave_encashment.js | 6 +++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/erpnext/hr/doctype/leave_allocation/leave_allocation.js b/erpnext/hr/doctype/leave_allocation/leave_allocation.js index 210a73cfe5..a184cc7d15 100755 --- a/erpnext/hr/doctype/leave_allocation/leave_allocation.js +++ b/erpnext/hr/doctype/leave_allocation/leave_allocation.js @@ -5,20 +5,23 @@ cur_frm.add_fetch('employee','employee_name','employee_name'); frappe.ui.form.on("Leave Allocation", { onload: function(frm) { + // Ignore cancellation of doctype on cancel all. + frm.ignored_doctypes_on_cancel_all = ["Leave Ledger Entry"]; + if(!frm.doc.from_date) frm.set_value("from_date", frappe.datetime.get_today()); frm.set_query("employee", function() { return { query: "erpnext.controllers.queries.employee_query" - } + }; }); frm.set_query("leave_type", function() { return { filters: { is_lwp: 0 } - } - }) + }; + }); }, refresh: function(frm) { diff --git a/erpnext/hr/doctype/leave_application/leave_application.js b/erpnext/hr/doctype/leave_application/leave_application.js index 4001a45507..a0cce0a80f 100755 --- a/erpnext/hr/doctype/leave_application/leave_application.js +++ b/erpnext/hr/doctype/leave_application/leave_application.js @@ -19,6 +19,10 @@ frappe.ui.form.on("Leave Application", { frm.set_query("employee", erpnext.queries.employee); }, onload: function(frm) { + + // Ignore cancellation of doctype on cancel all. + frm.ignored_doctypes_on_cancel_all = ["Leave Ledger Entry"]; + if (!frm.doc.posting_date) { frm.set_value("posting_date", frappe.datetime.get_today()); } diff --git a/erpnext/hr/doctype/leave_encashment/leave_encashment.js b/erpnext/hr/doctype/leave_encashment/leave_encashment.js index 701c2f0f31..d5e7adab74 100644 --- a/erpnext/hr/doctype/leave_encashment/leave_encashment.js +++ b/erpnext/hr/doctype/leave_encashment/leave_encashment.js @@ -2,6 +2,10 @@ // For license information, please see license.txt frappe.ui.form.on('Leave Encashment', { + onload: function(frm) { + // Ignore cancellation of doctype on cancel all. + frm.ignored_doctypes_on_cancel_all = ["Leave Ledger Entry"]; + }, setup: function(frm) { frm.set_query("leave_type", function() { return { @@ -33,7 +37,7 @@ frappe.ui.form.on('Leave Encashment', { doc: frm.doc, callback: function(r) { frm.refresh_fields(); - } + } }); } } From 759632c025f4f545424c69df60919dc4ec3a62a8 Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Fri, 14 Aug 2020 12:26:04 +0530 Subject: [PATCH 2/2] fix: requested Changes --- erpnext/hr/doctype/leave_allocation/leave_allocation.js | 2 +- erpnext/hr/doctype/leave_application/leave_application.js | 2 +- erpnext/hr/doctype/leave_encashment/leave_encashment.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/hr/doctype/leave_allocation/leave_allocation.js b/erpnext/hr/doctype/leave_allocation/leave_allocation.js index a184cc7d15..e9e129cdd2 100755 --- a/erpnext/hr/doctype/leave_allocation/leave_allocation.js +++ b/erpnext/hr/doctype/leave_allocation/leave_allocation.js @@ -6,7 +6,7 @@ cur_frm.add_fetch('employee','employee_name','employee_name'); frappe.ui.form.on("Leave Allocation", { onload: function(frm) { // Ignore cancellation of doctype on cancel all. - frm.ignored_doctypes_on_cancel_all = ["Leave Ledger Entry"]; + frm.ignore_doctypes_on_cancel_all = ["Leave Ledger Entry"]; if(!frm.doc.from_date) frm.set_value("from_date", frappe.datetime.get_today()); diff --git a/erpnext/hr/doctype/leave_application/leave_application.js b/erpnext/hr/doctype/leave_application/leave_application.js index a0cce0a80f..d62e418b17 100755 --- a/erpnext/hr/doctype/leave_application/leave_application.js +++ b/erpnext/hr/doctype/leave_application/leave_application.js @@ -21,7 +21,7 @@ frappe.ui.form.on("Leave Application", { onload: function(frm) { // Ignore cancellation of doctype on cancel all. - frm.ignored_doctypes_on_cancel_all = ["Leave Ledger Entry"]; + frm.ignore_doctypes_on_cancel_all = ["Leave Ledger Entry"]; if (!frm.doc.posting_date) { frm.set_value("posting_date", frappe.datetime.get_today()); diff --git a/erpnext/hr/doctype/leave_encashment/leave_encashment.js b/erpnext/hr/doctype/leave_encashment/leave_encashment.js index d5e7adab74..71a34226da 100644 --- a/erpnext/hr/doctype/leave_encashment/leave_encashment.js +++ b/erpnext/hr/doctype/leave_encashment/leave_encashment.js @@ -4,7 +4,7 @@ frappe.ui.form.on('Leave Encashment', { onload: function(frm) { // Ignore cancellation of doctype on cancel all. - frm.ignored_doctypes_on_cancel_all = ["Leave Ledger Entry"]; + frm.ignore_doctypes_on_cancel_all = ["Leave Ledger Entry"]; }, setup: function(frm) { frm.set_query("leave_type", function() {