Made some fields read only after saving

This commit is contained in:
Nabin Hait 2011-08-18 12:48:09 +05:30
parent 1d828f644a
commit 1ca982055b

View File

@ -7,15 +7,16 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
// ************************************** refresh *************************************************** // ************************************** refresh ***************************************************
cur_frm.cscript.refresh = function(doc, cdt, cdn) { cur_frm.cscript.refresh = function(doc, cdt, cdn) {
if(!doc.__islocal && doc.warehouse) set_field_permlevel('warehouse', 1); if(!doc.__islocal) {
if(!doc.__islocal && doc.item_code) set_field_permlevel('item_code', 1); flds = ['item_code', 'warehouse', 'purchase_document_type', 'purchase_document_no', 'purchase_date', 'purchase_time', 'purchase_rate', 'supplier']
if(doc.__islocal) set_field_permlevel('status', 0); for(i=0;i<flds.length;i++)
set_field_permlevel(flds[i], 1);
}
} }
// ************************************** triggers ************************************************** // ************************************** triggers **************************************************
// -------------
// item details // item details
// ------------- // -------------
cur_frm.add_fetch('item_code', 'item_name', 'item_name') cur_frm.add_fetch('item_code', 'item_name', 'item_name')
@ -24,23 +25,12 @@ cur_frm.add_fetch('item_code', 'brand', 'brand')
cur_frm.add_fetch('item_code', 'description', 'description') cur_frm.add_fetch('item_code', 'description', 'description')
cur_frm.add_fetch('item_code', 'warranty_period', 'warranty_period') cur_frm.add_fetch('item_code', 'warranty_period', 'warranty_period')
// ---------
// customer // customer
// --------- // ---------
cur_frm.add_fetch('customer', 'customer_name', 'customer_name') cur_frm.add_fetch('customer', 'customer_name', 'customer_name')
cur_frm.add_fetch('customer', 'address', 'delivery_address') cur_frm.add_fetch('customer', 'address', 'delivery_address')
cur_frm.add_fetch('customer', 'territory', 'territory') cur_frm.add_fetch('customer', 'territory', 'territory')
// ---------
// supplier
// ---------
//cur_frm.add_fetch('supplier', 'supplier_name', 'supplier_name')
//cur_frm.add_fetch('customer', 'address', 'supplier_address')
// ----------
// territory // territory
// ---------- // ----------
cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) { cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
@ -48,10 +38,8 @@ cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
} }
// Supplier // Supplier
//-------------
cur_frm.cscript.supplier = function(doc,dt,dn) { cur_frm.cscript.supplier = function(doc,dt,dn) {
if(doc.supplier) get_server_fields('get_default_supplier_address', JSON.stringify({supplier: doc.supplier}),'', doc, dt, dn, 1); if(doc.supplier) get_server_fields('get_default_supplier_address', JSON.stringify({supplier: doc.supplier}),'', doc, dt, dn, 1);
if(doc.supplier) unhide_field(['supplier_name','address_display']); if(doc.supplier) unhide_field(['supplier_name','address_display']);
} }