Disabled property set only once for has serial no and has batch no field in item doctype

This commit is contained in:
Rohit Waghchaure 2018-01-23 12:34:04 +05:30
parent 4f927ac3e8
commit 266e66cd1b
2 changed files with 10 additions and 3 deletions

View File

@ -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){

View File

@ -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",