From 21b1a00f613dc96cffc2bf5abd7d4e7349070645 Mon Sep 17 00:00:00 2001 From: anil pise Date: Sat, 15 Feb 2020 15:23:15 +0530 Subject: [PATCH 1/2] Fix:Child account which is not a group account is treating as Parent Account while creating New Department. #20599 --- erpnext/hr/doctype/department/department.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/erpnext/hr/doctype/department/department.js b/erpnext/hr/doctype/department/department.js index 963f3615cc..4185446d12 100644 --- a/erpnext/hr/doctype/department/department.js +++ b/erpnext/hr/doctype/department/department.js @@ -2,12 +2,18 @@ // For license information, please see license.txt frappe.ui.form.on('Department', { + onload: function(frm) { + frm.set_query("parent_department", function(){ + return { "filters": [["Department", "is_group", "=", 1]]} + }); + }, refresh: function(frm) { // read-only for root department if(!frm.doc.parent_department && !frm.is_new()) { frm.set_read_only(); frm.set_intro(__("This is a root department and cannot be edited.")); } + }, validate: function(frm) { if(frm.doc.name=="All Departments") { From 7c474130ea98789227e02537c65cc5b397fcd47d Mon Sep 17 00:00:00 2001 From: anil pise Date: Sat, 15 Feb 2020 15:58:57 +0530 Subject: [PATCH 2/2] fix: Removed Missing semicolon and Mixed spaces and tabs and Trailing spaces not allowed. --- erpnext/hr/doctype/department/department.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/erpnext/hr/doctype/department/department.js b/erpnext/hr/doctype/department/department.js index 4185446d12..7db8cfbd60 100644 --- a/erpnext/hr/doctype/department/department.js +++ b/erpnext/hr/doctype/department/department.js @@ -4,8 +4,8 @@ frappe.ui.form.on('Department', { onload: function(frm) { frm.set_query("parent_department", function(){ - return { "filters": [["Department", "is_group", "=", 1]]} - }); + return {"filters": [["Department", "is_group", "=", 1]]}; + }); }, refresh: function(frm) { // read-only for root department @@ -13,7 +13,6 @@ frappe.ui.form.on('Department', { frm.set_read_only(); frm.set_intro(__("This is a root department and cannot be edited.")); } - }, validate: function(frm) { if(frm.doc.name=="All Departments") {