mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 11:19:09 +00:00
[get_query]to server side
This commit is contained in:
@@ -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';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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" } }
|
||||
|
||||
@@ -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});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user