fix: show or hide section or attributes depending on other attributes… (#22861)
* fix: show or hide section or attributes depending on other attributes for better UI
* Update erpnext/stock/doctype/item/item.js
Co-authored-by: Marica <maricadsouza221197@gmail.com>
* fix: made has_variants checkbox to read_only if stock_exists
Co-authored-by: Marica <maricadsouza221197@gmail.com>
diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js
index 735f35f..38e5fe5 100644
--- a/erpnext/stock/doctype/item/item.js
+++ b/erpnext/stock/doctype/item/item.js
@@ -117,7 +117,7 @@
const stock_exists = (frm.doc.__onload
&& frm.doc.__onload.stock_exists) ? 1 : 0;
- ['is_stock_item', 'has_serial_no', 'has_batch_no'].forEach((fieldname) => {
+ ['is_stock_item', 'has_serial_no', 'has_batch_no', 'has_variants'].forEach((fieldname) => {
frm.set_df_property(fieldname, 'read_only', stock_exists);
});
diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json
index 963c87a..45526a3 100644
--- a/erpnext/stock/doctype/item/item.json
+++ b/erpnext/stock/doctype/item/item.json
@@ -473,6 +473,7 @@
},
{
"default": "0",
+ "depends_on": "has_batch_no",
"fieldname": "retain_sample",
"fieldtype": "Check",
"label": "Retain Sample"
@@ -499,7 +500,7 @@
"oldfieldtype": "Select"
},
{
- "depends_on": "eval:doc.is_stock_item || doc.is_fixed_asset",
+ "depends_on": "has_serial_no",
"description": "Example: ABCD.#####\nIf series is set and Serial No is not mentioned in transactions, then automatic serial number will be created based on this series. If you always want to explicitly mention Serial Nos for this item. leave this blank.",
"fieldname": "serial_no_series",
"fieldtype": "Data",
@@ -1061,7 +1062,7 @@
"image_field": "image",
"links": [],
"max_attachments": 1,
- "modified": "2020-06-30 12:01:07.534447",
+ "modified": "2020-07-31 21:21:10.956453",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item",