[get_query]to server side

This commit is contained in:
Saurabh
2013-07-09 18:20:49 +05:30
parent 38683718e1
commit 2e3c06e66d
33 changed files with 13 additions and 193 deletions

View File

@@ -125,7 +125,6 @@ cur_frm.fields_dict['customer_group'].get_query = function(doc,dt,dn) {
return{
filters:{'is_group': 'No'}
}
// return 'SELECT `tabCustomer Group`.`name`, `tabCustomer Group`.`parent_customer_group` FROM `tabCustomer Group` WHERE `tabCustomer Group`.`is_group` = "No" AND `tabCustomer Group`.`docstatus`!= 2 AND `tabCustomer Group`.%(key)s LIKE "%s" ORDER BY `tabCustomer Group`.`name` ASC LIMIT 50';
}

View File

@@ -62,27 +62,20 @@ cur_frm.cscript.onload = function(doc, dt, dn) {
cur_frm.fields_dict['delivery_note_no'].get_query = function(doc) {
doc = locals[this.doctype][this.docname];
var filter = {
'company': doc.company,
'docstatus': 1,
'per_installed': 99.99
'company': doc.company,
'docstatus': 1,
'per_installed': 99.99
};
if(doc.customer) filter['customer'] = doc.customer;
return{
filters:filter
}
// {
// cond = '`tabDelivery Note`.customer = "'+doc.customer+'" AND';
// }
// return repl('SELECT DISTINCT `tabDelivery Note`.name, `tabDelivery Note`.customer_name FROM `tabDelivery Note`, `tabDelivery Note Item` WHERE `tabDelivery Note`.company = "%(company)s" AND `tabDelivery Note`.docstatus = 1 AND ifnull(`tabDelivery Note`.per_installed,0) < 99.99 AND %(cond)s `tabDelivery Note`.name LIKE "%s" ORDER BY `tabDelivery Note`.name DESC LIMIT 50', {company:doc.company, cond:cond});
return { filters: filter }
}
cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
return{
filters{ 'is_group': "No" }
filters: { 'is_group': "No" }
}
// 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';
}
cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
@@ -93,14 +86,12 @@ cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
return{
filters: { 'customer': doc.customer }
}
// return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
}
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
return{
filters: { 'customer': doc.customer }
}
// return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
}
cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) {

View File

@@ -157,18 +157,12 @@ cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
return {
filters:{'customer':doc.customer}
}
// return 'SELECT name, address_line1, city FROM tabAddress \
// WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND \
// %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50';
}
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
if (!doc.customer) msgprint("Please select customer first");
else {
filters:{'customer':doc.customer}
// return 'SELECT name, CONCAT(first_name," ",ifnull(last_name,"")) As FullName, \
// department, designation FROM tabContact WHERE customer = "'+ doc.customer +
// '" AND docstatus != 2 AND %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50';
}
}
@@ -177,7 +171,6 @@ cur_frm.fields_dict['lead'].get_query = function(doc,cdt,cdn){
return {
query: "selling.doctype.opportunity.opportunity.get_lead"
}
// return 'SELECT `tabLead`.name, `tabLead`.lead_name FROM `tabLead` WHERE `tabLead`.%(key)s LIKE "%s" ORDER BY `tabLead`.`name` ASC LIMIT 50';
}
cur_frm.cscript.lead = function(doc, cdt, cdn) {
@@ -243,7 +236,6 @@ cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
return{
filters:{'is_group': 'No'}
}
// 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';}
cur_frm.fields_dict.lead.get_query = function(doc,cdt,cdn) {
return { query:"controllers.queries.lead_query" } }

View File

@@ -202,7 +202,6 @@ cur_frm.fields_dict['quotation_details'].grid.get_field('item_code').get_query=
cond: cond,
}
}
// return repl("SELECT name, item_name, description FROM `tabItem` item WHERE item.%(key)s LIKE '%s' %(cond)s ORDER BY item.item_code DESC LIMIT 50", {cond:cond});
}
}

View File

@@ -27,9 +27,6 @@ cur_frm.fields_dict.new_item_code.get_query = function() {
return{
query: "selling.doctype.sales_bom.sales_bom.get_new_item_code"
}
// return 'select name, description from tabItem where is_stock_item="No" and is_sales_item="Yes"\
// and name not in (select name from `tabSales BOM`)\
// and `%(key)s` like "%s"'
}
cur_frm.fields_dict.new_item_code.query_description = 'Select Item where "Is Stock Item" is "No" \
and "Is Sales Item" is "Yes" and there is no other Sales BOM';