get_query for profile based link fields to enable searching by name

This commit is contained in:
Anand Doshi
2012-11-19 15:43:18 +05:30
parent f26511e466
commit e65e621145
11 changed files with 65 additions and 17 deletions

View File

@@ -43,6 +43,14 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
cur_frm.add_fetch('customer', 'customer_name', 'company_name');
cur_frm.cscript.make_communication_body();
if(cur_frm.fields_dict.lead_owner.df.options.match(/^Profile/)) {
cur_frm.fields_dict.lead_owner.get_query = erpnext.utils.profile_query;
}
if(cur_frm.fields_dict.contact_by.df.options.match(/^Profile/)) {
cur_frm.fields_dict.contact_by.get_query = erpnext.utils.profile_query;
}
}
cur_frm.cscript.refresh_custom_buttons = function(doc) {
@@ -140,4 +148,4 @@ cur_frm.cscript['Create Opportunity'] = function(){
//get query select Territory
cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';
}
}

View File

@@ -49,6 +49,10 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
}
cur_frm.cscript.make_communication_body();
if(cur_frm.fields_dict.contact_by.df.options.match(/^Profile/)) {
cur_frm.fields_dict.contact_by.get_query = erpnext.utils.profile_query;
}
}
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
@@ -204,4 +208,4 @@ cur_frm.cscript['Declare Opportunity Lost'] = function(){
//get query select Territory
cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';}
return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';}

View File

@@ -50,6 +50,10 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
}
}
cur_frm.cscript.make_communication_body();
if(cur_frm.fields_dict.contact_by.df.options.match(/^Profile/)) {
cur_frm.fields_dict.contact_by.get_query = erpnext.utils.profile_query;
}
}
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
@@ -337,4 +341,4 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
doctype: 'Quotation'
}
cur_frm.cscript.notify(doc, args);
}
}