From 266e66cd1b440fb439800f2f460e7cc20fc63cfd Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 23 Jan 2018 12:34:04 +0530 Subject: [PATCH] Disabled property set only once for has serial no and has batch no field in item doctype --- erpnext/stock/doctype/item/item.js | 7 +++++++ erpnext/stock/doctype/item/item.json | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js index aed6f41040..4e61bd9fe6 100644 --- a/erpnext/stock/doctype/item/item.js +++ b/erpnext/stock/doctype/item/item.js @@ -106,6 +106,13 @@ frappe.ui.form.on("Item", { frappe.set_route("Form", "Item Variant Settings"); }, __("View")); } + + const stock_exists = (frm.doc.__onload + && frm.doc.__onload.stock_exists) ? 1 : 0; + + ['has_serial_no', 'has_batch_no'].forEach((fieldname) => { + frm.set_df_property(fieldname, 'read_only', stock_exists); + }); }, validate: function(frm){ diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json index 7d18dd6f60..7fa4b539f0 100644 --- a/erpnext/stock/doctype/item/item.json +++ b/erpnext/stock/doctype/item/item.json @@ -1180,7 +1180,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, - "set_only_once": 1, + "set_only_once": 0, "unique": 0 }, { @@ -1370,7 +1370,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, - "set_only_once": 1, + "set_only_once": 0, "unique": 0 }, { @@ -3453,7 +3453,7 @@ "issingle": 0, "istable": 0, "max_attachments": 1, - "modified": "2017-12-27 15:47:17.039337", + "modified": "2018-01-23 12:21:16.641517", "modified_by": "Administrator", "module": "Stock", "name": "Item",