fix in buttons displayed - on change of status in lead form

This commit is contained in:
Anand Doshi 2012-06-18 18:04:28 +05:30
parent 422a27cde0
commit f8946b1e31
2 changed files with 16 additions and 7 deletions

View File

@ -45,15 +45,24 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
cur_frm.cscript.make_communication_body();
}
cur_frm.cscript.refresh_custom_buttons = function() {
cur_frm.clear_custom_buttons();
if(!doc.__islocal && !in_list(['Converted', 'Lead Lost'], doc.status)) {
if (doc.source != 'Existing Customer') {
cur_frm.add_custom_button('Create Customer',
cur_frm.cscript['Create Customer']);
}
cur_frm.add_custom_button('Create Opportunity',
cur_frm.cscript['Create Opportunity']);
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
}
}
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
// custom buttons
//---------------
cur_frm.clear_custom_buttons()
if(!doc.__islocal && !in_list(['Converted', 'Lead Lost'], doc.status)) {
if (doc.source != 'Existing Customer') cur_frm.add_custom_button('Create Customer', cur_frm.cscript['Create Customer']);
cur_frm.add_custom_button('Create Opportunity', cur_frm.cscript['Create Opportunity']);
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
}
cur_frm.cscript.refresh_custom_buttons();
erpnext.hide_naming_series();
if (!doc.__islocal) cur_frm.cscript.render_communication_list(doc, cdt, cdn);

View File

@ -1748,7 +1748,7 @@ continue;var fn=f.fieldname?f.fieldname:f.label;var fld=make_field(f,this.doctyp
if(f.fieldtype=='Section Break'){sec=fld;this.sections.push(fld);}
if((f.fieldtype=='Section Break')&&(fl[i+1])&&(fl[i+1].fieldtype!='Column Break')&&!f.hidden){var c=this.layout.addcell();$y(c.wrapper,{padding:'8px'});}}}
_f.Frm.prototype.add_custom_button=function(label,fn,icon){this.frm_head.appframe.add_button(label,fn,icon);}
_f.Frm.prototype.clear_custom_buttons=function(){}
_f.Frm.prototype.clear_custom_buttons=function(){this.frm_head.refresh_toolbar()}
_f.Frm.prototype.add_fetch=function(link_field,src_field,tar_field){if(!this.fetch_dict[link_field]){this.fetch_dict[link_field]={'columns':[],'fields':[]}}
this.fetch_dict[link_field].columns.push(src_field);this.fetch_dict[link_field].fields.push(tar_field);}
_f.Frm.prototype.setup_client_script=function(){if(this.meta.client_script_core||this.meta.client_script||this.meta.__js){this.runclientscript('setup',this.doctype,this.docname);}}