added customer get_query to allow search based on customer name. also don't show name again if id naming is based on customer name and not series
This commit is contained in:
@@ -27,4 +27,6 @@ cur_frm.cscript.refresh = function(doc) {
|
||||
cur_frm.gantt_area.empty();
|
||||
erpnext.show_task_gantt(cur_frm.gantt_area, cur_frm.docname);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.customer.get_query = erpnext.utils.customer_query;
|
||||
@@ -27,6 +27,8 @@ cur_frm.cscript.project = function(doc, cdt, cdn){
|
||||
if(doc.project) get_server_fields('get_project_details', '','', doc, cdt, cdn, 1);
|
||||
}
|
||||
|
||||
|
||||
// TODO: remove these? field doesn't exist, but custom field could exist
|
||||
cur_frm.fields_dict['customer'].get_query = function(doc,cdt,cdn){
|
||||
var cond='';
|
||||
if(doc.project) cond = 'ifnull(`tabProject`.customer, "") = `tabCustomer`.name AND ifnull(`tabProject`.name, "") = "'+doc.project+'" AND';
|
||||
|
||||
@@ -41,7 +41,8 @@ class DocType:
|
||||
if cust:
|
||||
ret = {'customer': cust and cust[0][0] or '', 'customer_name': cust and cust[0][1] or ''}
|
||||
return ret
|
||||
|
||||
|
||||
# TODO: Remove these? as the field customer doesn't exists
|
||||
def get_customer_details(self):
|
||||
cust = sql("select customer_name from `tabCustomer` where name=%s", self.doc.customer)
|
||||
if cust:
|
||||
|
||||
@@ -44,4 +44,7 @@ cur_frm.fields_dict['timesheet_details'].grid.get_field("task_name").get_query =
|
||||
if(d.project_name) cond = 'ifnull(`tabTask`.project, "") = "'+d.project_name+'" AND';
|
||||
|
||||
return repl('SELECT distinct `tabTask`.`subject` FROM `tabTask` WHERE %(cond)s `tabTask`.`subject` LIKE "%s" ORDER BY `tabTask`.`subject` ASC LIMIT 50', {cond:cond});
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.timesheet_details.grid.get_field("customer_name").get_query =
|
||||
erpnext.utils.customer_query;
|
||||
Reference in New Issue
Block a user