fix: Insert Supplier Group via List View (#22403)
diff --git a/erpnext/setup/doctype/customer_group/customer_group.js b/erpnext/setup/doctype/customer_group/customer_group.js
index c199a8e..44a5019 100644
--- a/erpnext/setup/doctype/customer_group/customer_group.js
+++ b/erpnext/setup/doctype/customer_group/customer_group.js
@@ -8,7 +8,7 @@
cur_frm.cscript.set_root_readonly = function(doc) {
// read-only for root customer group
- if(!doc.parent_customer_group) {
+ if(!doc.parent_customer_group && !doc.__islocal) {
cur_frm.set_read_only();
cur_frm.set_intro(__("This is a root customer group and cannot be edited."));
} else {
@@ -20,7 +20,8 @@
cur_frm.fields_dict['parent_customer_group'].get_query = function(doc,cdt,cdn) {
return {
filters: {
- 'is_group': 1
+ 'is_group': 1,
+ 'name': ['!=', cur_frm.doc.customer_group_name]
}
}
}
diff --git a/erpnext/setup/doctype/item_group/item_group.js b/erpnext/setup/doctype/item_group/item_group.js
index df22231..9892dc3 100644
--- a/erpnext/setup/doctype/item_group/item_group.js
+++ b/erpnext/setup/doctype/item_group/item_group.js
@@ -66,7 +66,7 @@
set_root_readonly: function(frm) {
// read-only for root item group
frm.set_intro("");
- if(!frm.doc.parent_item_group) {
+ if(!frm.doc.parent_item_group && !frm.doc.__islocal) {
frm.set_read_only();
frm.set_intro(__("This is a root item group and cannot be edited."), true);
}
diff --git a/erpnext/setup/doctype/sales_person/sales_person.js b/erpnext/setup/doctype/sales_person/sales_person.js
index 89ca4a9..8f7593d 100644
--- a/erpnext/setup/doctype/sales_person/sales_person.js
+++ b/erpnext/setup/doctype/sales_person/sales_person.js
@@ -19,7 +19,7 @@
}
}
};
-
+
frm.make_methods = {
'Sales Order': () => frappe.new_doc("Sales Order")
.then(() => frm.add_child("sales_team", {"sales_person": frm.doc.name}))
@@ -33,7 +33,7 @@
cur_frm.cscript.set_root_readonly = function(doc) {
// read-only for root
- if(!doc.parent_sales_person) {
+ if(!doc.parent_sales_person && !doc.__islocal) {
cur_frm.set_read_only();
cur_frm.set_intro(__("This is a root sales person and cannot be edited."));
} else {
diff --git a/erpnext/setup/doctype/supplier_group/supplier_group.js b/erpnext/setup/doctype/supplier_group/supplier_group.js
index ac5bda6..e75030d 100644
--- a/erpnext/setup/doctype/supplier_group/supplier_group.js
+++ b/erpnext/setup/doctype/supplier_group/supplier_group.js
@@ -8,7 +8,7 @@
cur_frm.cscript.set_root_readonly = function(doc) {
// read-only for root customer group
- if(!doc.parent_supplier_group) {
+ if(!doc.parent_supplier_group && !doc.__islocal) {
cur_frm.set_read_only();
cur_frm.set_intro(__("This is a root supplier group and cannot be edited."));
} else {
@@ -20,7 +20,8 @@
cur_frm.fields_dict['parent_supplier_group'].get_query = function() {
return {
filters: {
- 'is_group': 1
+ 'is_group': 1,
+ 'name': ['!=', cur_frm.doc.supplier_group_name]
}
};
};
diff --git a/erpnext/setup/doctype/territory/territory.js b/erpnext/setup/doctype/territory/territory.js
index 1eb9958..ceec47ae 100644
--- a/erpnext/setup/doctype/territory/territory.js
+++ b/erpnext/setup/doctype/territory/territory.js
@@ -20,7 +20,7 @@
cur_frm.cscript.set_root_readonly = function(doc) {
// read-only for root territory
- if(!doc.parent_territory) {
+ if(!doc.parent_territory && !doc.__islocal) {
cur_frm.set_read_only();
cur_frm.set_intro(__("This is a root territory and cannot be edited."));
} else {