From 2cf4168009c0b32ee885ba1a16bc5a5aad97f1e2 Mon Sep 17 00:00:00 2001 From: Afshan <33727827+AfshanKhan@users.noreply.github.com> Date: Thu, 6 Aug 2020 19:04:35 +0530 Subject: [PATCH] =?UTF-8?q?fix:=20show=20or=20hide=20section=20or=20attrib?= =?UTF-8?q?utes=20depending=20on=20other=20attributes=E2=80=A6=20(#22933)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: show or hide section or attributes depending on other attributes for better UI * fix:depends on: batch_no for retain sample Co-authored-by: Marica --- erpnext/stock/doctype/item/item.js | 2 +- erpnext/stock/doctype/item/item.json | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js index c10e62973bb..34476273c28 100644 --- a/erpnext/stock/doctype/item/item.js +++ b/erpnext/stock/doctype/item/item.js @@ -117,7 +117,7 @@ frappe.ui.form.on("Item", { 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 b7c2b962f97..11be6588957 100644 --- a/erpnext/stock/doctype/item/item.json +++ b/erpnext/stock/doctype/item/item.json @@ -472,6 +472,7 @@ }, { "default": "0", + "depends_on": "has_batch_no", "fieldname": "retain_sample", "fieldtype": "Check", "label": "Retain Sample" @@ -498,7 +499,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", @@ -1059,7 +1060,7 @@ "idx": 2, "image_field": "image", "max_attachments": 1, - "modified": "2020-07-01 12:43:10.656530", + "modified": "2020-08-06 17:03:26.594319", "modified_by": "Administrator", "module": "Stock", "name": "Item",