diff --git a/selling/doctype/quotation/quotation.js b/selling/doctype/quotation/quotation.js index 532cecc866..330e4e7e16 100644 --- a/selling/doctype/quotation/quotation.js +++ b/selling/doctype/quotation/quotation.js @@ -93,7 +93,6 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { } erpnext.hide_naming_series(); - cur_frm.toggle_display("contact_section", doc.customer || doc.lead); if (!doc.__islocal) { @@ -118,8 +117,9 @@ cur_frm.cscript.customer = function(doc,dt,dn) { if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', '', callback); - - cur_frm.toggle_display("contact_section", doc.customer); + if(doc.customer) unhide_field(['customer_address','contact_person','territory', 'customer_group']); + cur_frm.toggle_display("contact_section", doc.customer || doc.lead); + } cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) { @@ -133,6 +133,8 @@ cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc cur_frm.fields_dict.lead.get_query = erpnext.utils.lead_query; cur_frm.cscript.lead = function(doc, cdt, cdn) { + cur_frm.toggle_display("contact_section", doc.customer || doc.lead); + if(doc.lead) { get_server_fields('get_lead_details', doc.lead,'', doc, cdt, cdn, 1); unhide_field('territory'); diff --git a/selling/doctype/sales_order/sales_order.js b/selling/doctype/sales_order/sales_order.js index f8d9fde41d..607b132b9b 100644 --- a/selling/doctype/sales_order/sales_order.js +++ b/selling/doctype/sales_order/sales_order.js @@ -36,9 +36,9 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) { // load default charges if(doc.__islocal && !doc.customer){ - hide_field(['customer_address', 'contact_person', 'customer_name', - 'address_display', 'contact_display', 'contact_mobile', - 'contact_email', 'territory', 'customer_group']); + hide_field(['customer_address','contact_person', 'customer_name', + 'address_display', 'contact_display', 'contact_mobile', + 'contact_email', 'territory', 'customer_group']); } } @@ -111,6 +111,8 @@ cur_frm.cscript.customer = function(doc,dt,dn) { var pl = doc.price_list_name; var callback = function(r,rt) { var callback2 = function(r, rt) { + if(doc.customer) + unhide_field(['customer_address', 'contact_person', 'territory','customer_group']); cur_frm.refresh(); if(!onload && (pl != doc.price_list_name)) cur_frm.cscript.price_list_name(doc, dt, dn); @@ -120,7 +122,8 @@ cur_frm.cscript.customer = function(doc,dt,dn) { get_server_fields('get_shipping_address',doc.customer,'',doc, dt, dn, 0, callback2); } - if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', '', callback); + if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), + 'get_default_customer_address', '', callback); } cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) { @@ -133,7 +136,8 @@ cur_frm.cscript.pull_quotation_details = function(doc,dt,dn) { if(!r.exc){ doc.quotation_no = r.message; if(doc.quotation_no) { - unhide_field(['quotation_date', 'customer_address', 'contact_person', 'territory', 'customer_group']); + unhide_field(['quotation_date', 'customer_address', + 'contact_person', 'territory', 'customer_group']); if(doc.customer) get_server_fields('get_shipping_address', doc.customer, '', doc, dt, dn, 0); } cur_frm.refresh(); diff --git a/stock/doctype/delivery_note/delivery_note.js b/stock/doctype/delivery_note/delivery_note.js index 21e6dc0514..223b06460c 100644 --- a/stock/doctype/delivery_note/delivery_note.js +++ b/stock/doctype/delivery_note/delivery_note.js @@ -37,7 +37,9 @@ cur_frm.cscript.onload = function(doc, dt, dn) { if(!doc.posting_time) doc.posting_time = wn.datetime.get_cur_time() if(doc.__islocal){ - hide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']); + hide_field(['customer_address', 'contact_person', 'customer_name', + 'address_display', 'contact_display', 'contact_mobile', + 'contact_email', 'territory', 'customer_group']); } }