From 26b3ef10eccc3b51775bd45d9b7995ff4f284916 Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Thu, 18 Jul 2024 20:56:56 +0200 Subject: [PATCH 1/3] fix(Supplier Group): properly call frm.set_read_only() --- erpnext/setup/doctype/supplier_group/supplier_group.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/setup/doctype/supplier_group/supplier_group.js b/erpnext/setup/doctype/supplier_group/supplier_group.js index c697a99cb4..37716b1727 100644 --- a/erpnext/setup/doctype/supplier_group/supplier_group.js +++ b/erpnext/setup/doctype/supplier_group/supplier_group.js @@ -38,9 +38,9 @@ frappe.ui.form.on("Supplier Group", { frm.set_intro(frm.doc.__islocal ? "" : __("There is nothing to edit.")); frm.trigger("set_root_readonly"); }, - set_root_readonly: function(frm) { - if(!frm.doc.parent_supplier_group && !frm.doc.__islocal) { - frm.trigger("set_read_only"); + set_root_readonly: function (frm) { + if (!frm.doc.parent_supplier_group && !frm.doc.__islocal) { + frm.set_read_only(); frm.set_intro(__("This is a root supplier group and cannot be edited.")); } else { frm.set_intro(null); -- GitLab From 16484062bdfe1c25de74947bf5e9a0dbed0737e9 Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Thu, 18 Jul 2024 20:59:26 +0200 Subject: [PATCH 2/3] fix(Supplier Group): remove useless headline Not sure what it was supposed to mean. It was only visible on root group, along with the other message. --- erpnext/setup/doctype/supplier_group/supplier_group.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/erpnext/setup/doctype/supplier_group/supplier_group.js b/erpnext/setup/doctype/supplier_group/supplier_group.js index 37716b1727..64d5a9a257 100644 --- a/erpnext/setup/doctype/supplier_group/supplier_group.js +++ b/erpnext/setup/doctype/supplier_group/supplier_group.js @@ -34,8 +34,7 @@ frappe.ui.form.on("Supplier Group", { } }); }, - refresh: function(frm) { - frm.set_intro(frm.doc.__islocal ? "" : __("There is nothing to edit.")); + refresh: function (frm) { frm.trigger("set_root_readonly"); }, set_root_readonly: function (frm) { -- GitLab From 035294e69d55cafd9696ec216834fa847b9b85c0 Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Thu, 18 Jul 2024 21:00:42 +0200 Subject: [PATCH 3/3] refactor(Supplier Group): use frm.is_new() instead of frm.doc.__islocal --- erpnext/setup/doctype/supplier_group/supplier_group.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/setup/doctype/supplier_group/supplier_group.js b/erpnext/setup/doctype/supplier_group/supplier_group.js index 64d5a9a257..08940e54c1 100644 --- a/erpnext/setup/doctype/supplier_group/supplier_group.js +++ b/erpnext/setup/doctype/supplier_group/supplier_group.js @@ -38,7 +38,7 @@ frappe.ui.form.on("Supplier Group", { frm.trigger("set_root_readonly"); }, set_root_readonly: function (frm) { - if (!frm.doc.parent_supplier_group && !frm.doc.__islocal) { + if (!frm.doc.parent_supplier_group && !frm.is_new()) { frm.set_read_only(); frm.set_intro(__("This is a root supplier group and cannot be edited.")); } else { -- GitLab