From 2e3c06e66d06244bd1493c346691ce00d56e2603 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Tue, 9 Jul 2013 18:20:49 +0530 Subject: [PATCH] [get_query]to server side --- accounts/doctype/cost_center/cost_center.js | 4 +- .../journal_voucher/journal_voucher.js | 3 -- .../period_closing_voucher.js | 1 - accounts/doctype/pos_setting/pos_setting.js | 6 --- .../purchase_invoice/purchase_invoice.js | 45 ------------------- .../doctype/sales_invoice/sales_invoice.js | 13 ------ .../sales_taxes_and_charges_master.js | 2 - .../doctype/purchase_order/purchase_order.js | 14 ------ .../quality_inspection/quality_inspection.js | 2 - .../supplier_quotation/supplier_quotation.js | 14 +----- hr/doctype/appraisal/appraisal.js | 4 +- .../salary_structure/salary_structure.js | 4 +- .../production_order/production_order.js | 4 -- projects/doctype/task/task.js | 2 +- projects/doctype/task/task.py | 2 +- selling/doctype/customer/customer.js | 1 - .../installation_note/installation_note.js | 21 +++------ selling/doctype/opportunity/opportunity.js | 8 ---- selling/doctype/quotation/quotation.js | 1 - selling/doctype/sales_bom/sales_bom.js | 3 -- .../authorization_rule/authorization_rule.js | 5 --- setup/doctype/company/company.js | 14 ------ .../contact_control/contact_control.js | 3 +- .../doctype/customer_group/customer_group.js | 4 -- setup/doctype/item_group/item_group.js | 1 - setup/doctype/sales_partner/sales_partner.js | 1 - setup/doctype/sales_person/sales_person.js | 2 - setup/doctype/territory/territory.js | 2 - stock/doctype/item/item.js | 1 - .../landed_cost_wizard/landed_cost_wizard.js | 1 - stock/doctype/packing_slip/packing_slip.js | 1 - stock/doctype/serial_no/serial_no.js | 1 - .../doctype/customer_issue/customer_issue.js | 16 ------- 33 files changed, 13 insertions(+), 193 deletions(-) diff --git a/accounts/doctype/cost_center/cost_center.js b/accounts/doctype/cost_center/cost_center.js index ad3a16237e..d273e53e56 100644 --- a/accounts/doctype/cost_center/cost_center.js +++ b/accounts/doctype/cost_center/cost_center.js @@ -45,8 +45,7 @@ cur_frm.fields_dict['budget_details'].grid.get_field('account').get_query = func ['Account', 'group_or_ledger', 'is not', 'NULL'] ] } - // return 'SELECT DISTINCT `tabAccount`.`name`,`tabAccount`.debit_or_credit,`tabAccount`.group_or_ledger FROM `tabAccount` WHERE `tabAccount`.`company` = "' + doc.company_name + '" AND `tabAccount`.docstatus != 2 AND `tabAccount`.`is_pl_account` = "Yes" AND `tabAccount`.debit_or_credit = "Debit" AND `tabAccount`.`group_or_ledger` != "Group" AND `tabAccount`.`group_or_ledger` is not NULL AND `tabAccount`.`name` LIKE "%s" ORDER BY `tabAccount`.`name` LIMIT 50'; - } +} cur_frm.fields_dict['parent_cost_center'].get_query = function(doc){ return{ @@ -56,7 +55,6 @@ cur_frm.fields_dict['parent_cost_center'].get_query = function(doc){ ['Cost Center', 'company_name', 'is not', 'NULL'] ] } - // return 'SELECT DISTINCT `tabCost Center`.name FROM `tabCost Center` WHERE `tabCost Center`.group_or_ledger="Group" AND `tabCost Center`.docstatus != 2 AND `tabCost Center`.company_name="'+ doc.company_name+'" AND `tabCost Center`.company_name is not NULL AND `tabCost Center`.name LIKE "%s" ORDER BY `tabCost Center`.name LIMIT 50'; } //parent cost center diff --git a/accounts/doctype/journal_voucher/journal_voucher.js b/accounts/doctype/journal_voucher/journal_voucher.js index 2afea1bce2..ea07798178 100644 --- a/accounts/doctype/journal_voucher/journal_voucher.js +++ b/accounts/doctype/journal_voucher/journal_voucher.js @@ -196,7 +196,6 @@ cur_frm.fields_dict['entries'].grid.get_field('account').get_query = function(do cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = function(doc) { return { - // query: "accounts.utils.get_cost_center_list", filters: { 'company_name': doc.company, 'group_or_ledger': 'Ledger' @@ -207,7 +206,6 @@ cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = functio cur_frm.fields_dict['entries'].grid.get_field('against_voucher').get_query = function(doc) { var d = locals[this.doctype][this.docname]; return { - // query: "accounts.doctype.journal_voucher.journal_voucher.get_against_purchase_invoice", filters: [ ['Purchase Invoice', 'credit_to', '=', d.account], ['Purchase Invoice', 'docstatus', '=', 1], @@ -219,7 +217,6 @@ cur_frm.fields_dict['entries'].grid.get_field('against_voucher').get_query = fun cur_frm.fields_dict['entries'].grid.get_field('against_invoice').get_query = function(doc) { var d = locals[this.doctype][this.docname]; return { - // query: "accounts.doctype.journal_voucher.journal_voucher.get_against_sales_invoice", filters: [ ['Sales Invoice', 'debit_to', '=', d.account], ['Sales Invoice', 'docstatus', '=', 1], diff --git a/accounts/doctype/period_closing_voucher/period_closing_voucher.js b/accounts/doctype/period_closing_voucher/period_closing_voucher.js index c24f06b2a8..fd45841783 100644 --- a/accounts/doctype/period_closing_voucher/period_closing_voucher.js +++ b/accounts/doctype/period_closing_voucher/period_closing_voucher.js @@ -32,5 +32,4 @@ cur_frm.fields_dict['closing_account_head'].get_query = function(doc, cdt, cdn) "group_or_ledger": "Ledger" } } - // return 'SELECT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.is_pl_account = "No" AND `tabAccount`.debit_or_credit = "Credit" AND `tabAccount`.company = "'+ cstr(doc.company) +'" AND ifnull(`tabAccount`.freeze_account, "No") = "No" AND `tabAccount`.group_or_ledger = "Ledger" AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name ASC LIMIT 50'; } diff --git a/accounts/doctype/pos_setting/pos_setting.js b/accounts/doctype/pos_setting/pos_setting.js index b15ec3e04a..aa9cf11539 100755 --- a/accounts/doctype/pos_setting/pos_setting.js +++ b/accounts/doctype/pos_setting/pos_setting.js @@ -33,7 +33,6 @@ cur_frm.fields_dict['cash_bank_account'].get_query = function(doc,cdt,cdn) { 'company': doc.company } } - // return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.is_pl_account = "No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"' } // Income Account @@ -47,7 +46,6 @@ cur_frm.fields_dict['income_account'].get_query = function(doc,cdt,cdn) { 'account_type': "Income Account" } } - // return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Credit" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.account_type ="Income Account" AND tabAccount.%(key)s LIKE "%s"' } @@ -60,7 +58,6 @@ cur_frm.fields_dict['cost_center'].get_query = function(doc,cdt,cdn) { 'group_or_ledger': "Ledger", } } - // return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.`company_name` = "' +doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.`docstatus`!= 2 ORDER BY `tabCost Center`.`name` ASC LIMIT 50'; } //get query select Territory @@ -71,7 +68,6 @@ cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) { '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'; } @@ -82,12 +78,10 @@ cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) ['Print Heading', 'docstatus', '!=', 2] ] } - // return 'SELECT `tabPrint Heading`.name FROM `tabPrint Heading` WHERE `tabPrint Heading`.docstatus !=2 AND `tabPrint Heading`.name LIKE "%s" ORDER BY `tabPrint Heading`.name ASC LIMIT 50'; } cur_frm.fields_dict["expense_account"].get_query = function(doc) { return { - // "query": "accounts.utils.get_account_list", filters: { "is_pl_account": "Yes", "debit_or_credit": "Debit", diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.js b/accounts/doctype/purchase_invoice/purchase_invoice.js index 2e41d70af0..efe0c2a990 100644 --- a/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -155,14 +155,12 @@ cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) { return{ filters:{'supplier': doc.supplier} } - // return 'SELECT name,address_line1,city FROM tabAddress WHERE supplier = "'+ doc.supplier +'" 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:{'supplier': doc.supplier} } - // return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; } cur_frm.fields_dict['entries'].grid.get_field("item_code").get_query = function(doc, cdt, cdn) { @@ -183,43 +181,6 @@ cur_frm.fields_dict['credit_to'].get_query = function(doc) { 'company': doc.company } } - // return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Credit" AND tabAccount.is_pl_account="No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"' -} - -cur_frm.fields_dict['purchase_order_main'].get_query = function(doc) { - var filter = [ - ['Purchase Order', 'docstatus', '=', 1], - ['Purchase Order', 'status', '!=', 'Stopped'], - ['Purchase Order', 'per_billed', '<', 99.99], - ['Purchase Order', 'company', '=', doc.company] - ]; - var cond = []; - if (doc.supplier){ - cond = ['Purchase Order', 'supplier', '=', doc.supplier]; - // return 'SELECT `tabPurchase Order`.`name` FROM `tabPurchase Order` WHERE `tabPurchase Order`.`docstatus` = 1 AND `tabPurchase Order`.supplier = "'+ doc.supplier +'" AND `tabPurchase Order`.`status` != "Stopped" AND ifnull(`tabPurchase Order`.`per_billed`,0) < 99.99 AND `tabPurchase Order`.`company` = "' + doc.company + '" AND `tabPurchase Order`.%(key)s LIKE "%s" ORDER BY `tabPurchase Order`.`name` DESC LIMIT 50' - } - filter.push(cond); - return{ - filters: filter - } -} - -cur_frm.fields_dict['purchase_receipt_main'].get_query = function(doc) { - var filter = [ - ['Purchase Receipt', 'docstatus', '=', 1], - ['Purchase Receipt', 'status', '!=', 'Stopped'], - ['Purchase Receipt', 'per_billed', '<', 99.99], - ['Purchase Receipt', 'company', '=', doc.company] - ]; - var cond = []; - if (doc.supplier){ - ['Purchase Receipt', 'supplier', '=', doc.supplier]; - // return 'SELECT `tabPurchase Receipt`.`name` FROM `tabPurchase Receipt` WHERE `tabPurchase Receipt`.`docstatus` = 1 AND `tabPurchase Receipt`.supplier = "'+ doc.supplier +'" AND `tabPurchase Receipt`.`status` != "Stopped" AND ifnull(`tabPurchase Receipt`.`per_billed`, 0) < 99.99 AND `tabPurchase Receipt`.`company` = "' + doc.company + '" AND `tabPurchase Receipt`.%(key)s LIKE "%s" ORDER BY `tabPurchase Receipt`.`name` DESC LIMIT 50' - } - filter.push(cond); - return{ - filters: filter - } } // Get Print Heading @@ -229,7 +190,6 @@ return{ ['Print Heading', 'docstatus', '!=', 2] ] } - // return 'SELECT `tabPrint Heading`.name FROM `tabPrint Heading` WHERE `tabPrint Heading`.docstatus !=2 AND `tabPrint Heading`.name LIKE "%s" ORDER BY `tabPrint Heading`.name ASC LIMIT 50'; } cur_frm.fields_dict['entries'].grid.get_field("expense_head").get_query = function(doc) { @@ -241,7 +201,6 @@ cur_frm.fields_dict['entries'].grid.get_field("expense_head").get_query = functi 'company': doc.company } } - // return 'SELECT tabAccount.name FROM tabAccount WHERE (tabAccount.debit_or_credit="Debit" OR tabAccount.account_type = "Expense Account") AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"'; } cur_frm.cscript.expense_head = function(doc, cdt, cdn){ var d = locals[cdt][cdn]; @@ -256,7 +215,6 @@ cur_frm.cscript.expense_head = function(doc, cdt, cdn){ cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = function(doc) { return { - // query: "accounts.utils.get_cost_center_list", filters: { 'company_name': doc.company, 'group_or_ledger': 'Ledger' @@ -307,9 +265,6 @@ cur_frm.fields_dict['entries'].grid.get_field('project_name').get_query = functi ['Project', 'status', 'not in', 'Completed, Cancelled'] ] } - // return 'SELECT `tabProject`.name FROM `tabProject` \ - // WHERE `tabProject`.status not in ("Completed", "Cancelled") \ - // AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50'; } diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js index ef4b67816c..1487ec9872 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.js +++ b/accounts/doctype/sales_invoice/sales_invoice.js @@ -257,7 +257,6 @@ cur_frm.fields_dict.debit_to.get_query = function(doc) { 'company': doc.company } } - // return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.is_pl_account = "No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"' } cur_frm.fields_dict.cash_bank_account.get_query = function(doc) { @@ -269,7 +268,6 @@ cur_frm.fields_dict.cash_bank_account.get_query = function(doc) { 'company': doc.company } } - // return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.is_pl_account = "No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"' } cur_frm.fields_dict.write_off_account.get_query = function(doc) { @@ -281,7 +279,6 @@ cur_frm.fields_dict.write_off_account.get_query = function(doc) { 'company': doc.company } } - // return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.is_pl_account = "Yes" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"' } // Write off cost center @@ -294,7 +291,6 @@ cur_frm.fields_dict.write_off_cost_center.get_query = function(doc) { 'company_name': doc.company } } - // return 'SELECT `tabCost Center`.name FROM `tabCost Center` WHERE `tabCost Center`.group_or_ledger="Ledger" AND `tabCost Center`.docstatus!=2 AND `tabCost Center`.company_name="'+doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s"' } //project name @@ -304,12 +300,6 @@ cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) { query: "controllers.queries.get_project_name", filters: {'customer': doc.customer} } - // var cond = ''; - // if(doc.customer) cond = '(`tabProject`.customer = "'+doc.customer+'" OR IFNULL(`tabProject`.customer,"")="") AND'; - // return repl('SELECT `tabProject`.name FROM `tabProject` \ - // WHERE `tabProject`.status not in ("Completed", "Cancelled") \ - // AND %(cond)s `tabProject`.name LIKE "%s" \ - // ORDER BY `tabProject`.name ASC LIMIT 50', {cond:cond}); } //Territory @@ -318,7 +308,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'; } // Income Account in Details Table @@ -352,14 +341,12 @@ cur_frm.fields_dict['entries'].grid.get_field('warehouse').get_query= function(d ['Bin', 'actual_qty', '>', 0] ] } - // return "SELECT `tabBin`.`warehouse`, `tabBin`.`actual_qty` FROM `tabBin` WHERE `tabBin`.`item_code` = '"+ d.item_code +"' AND ifnull(`tabBin`.`actual_qty`,0) > 0 AND `tabBin`.`warehouse` like '%s' ORDER BY `tabBin`.`warehouse` DESC LIMIT 50"; } // Cost Center in Details Table // ----------------------------- cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = function(doc) { return { - // query: "accounts.utils.get_cost_center_list", filters: { 'company_name': doc.company, 'group_or_ledger': 'Ledger' diff --git a/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js b/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js index 81a5c709f0..9ec574ed33 100644 --- a/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js +++ b/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js @@ -144,7 +144,6 @@ cur_frm.fields_dict['other_charges'].grid.get_field("account_head").get_query = ['Account', 'company', '=', doc.company] ] } - // return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND tabAccount.account_type in ("Tax", "Chargeable", "Income Account") AND tabAccount.company = "'+doc.company+'" AND tabAccount.name LIKE "%s"' } cur_frm.fields_dict['other_charges'].grid.get_field("cost_center").get_query = function(doc) { @@ -152,7 +151,6 @@ cur_frm.fields_dict['other_charges'].grid.get_field("cost_center").get_query = f 'company_name': doc.company, 'group_or_ledger': "Ledger" } - // return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.`company_name` = "' +doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.`docstatus`!= 2 ORDER BY `tabCost Center`.`name` ASC LIMIT 50'; } diff --git a/buying/doctype/purchase_order/purchase_order.js b/buying/doctype/purchase_order/purchase_order.js index 1283ebc434..bccd4a9559 100644 --- a/buying/doctype/purchase_order/purchase_order.js +++ b/buying/doctype/purchase_order/purchase_order.js @@ -113,14 +113,12 @@ cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) { return { filters: {'supplier': doc.supplier} } - // return 'SELECT name,address_line1,city FROM tabAddress WHERE supplier = "'+ doc.supplier +'" 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: {'supplier': doc.supplier} } - // return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; } cur_frm.fields_dict['po_details'].grid.get_field('project_name').get_query = function(doc, cdt, cdn) { @@ -131,18 +129,6 @@ cur_frm.fields_dict['po_details'].grid.get_field('project_name').get_query = fun } } -cur_frm.fields_dict['indent_no'].get_query = function(doc) { - return{ - filters:[ - ['Material Request', 'material_request_type', '=', 'Purchase'], - ['Material Request', 'company', '=', doc.company], - ['Material Request', 'docstatus', '=', '1'], - ['Material Request', 'status', '!=', 'Stopped'], - ['Material Request', 'per_ordered', '<', 99.99] - ] - } -} - cur_frm.cscript.get_last_purchase_rate = function(doc, cdt, cdn){ $c_obj(make_doclist(doc.doctype, doc.name), 'get_last_purchase_rate', '', function(r, rt) { refresh_field(cur_frm.cscript.fname); diff --git a/buying/doctype/quality_inspection/quality_inspection.js b/buying/doctype/quality_inspection/quality_inspection.js index 1c12f3a8a5..72eaecb5a1 100644 --- a/buying/doctype/quality_inspection/quality_inspection.js +++ b/buying/doctype/quality_inspection/quality_inspection.js @@ -48,12 +48,10 @@ cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) { filter:{ 'parent': doc.purchase_receipt_no } - // return 'SELECT item_code, item_name, description FROM `tabPurchase Receipt Item` WHERE parent = "'+ doc.purchase_receipt_no +'" and docstatus != 2 AND item_code LIKE "%s" ORDER BY item_code ASC LIMIT 50'; else if (doc.delivery_note_no) filter:{ 'parent': doc.delivery_note_no } - // return 'SELECT item_code, item_name, description FROM `tabDelivery Note Item` WHERE parent = "'+ doc.delivery_note_no +'" and docstatus != 2 AND item_code LIKE "%s" ORDER BY item_code ASC LIMIT 50'; return{ filters: filter } diff --git a/buying/doctype/supplier_quotation/supplier_quotation.js b/buying/doctype/supplier_quotation/supplier_quotation.js index d0f1948ef0..54ef722885 100644 --- a/buying/doctype/supplier_quotation/supplier_quotation.js +++ b/buying/doctype/supplier_quotation/supplier_quotation.js @@ -72,18 +72,6 @@ cur_frm.fields_dict['quotation_items'].grid.get_field('project_name').get_query } } -cur_frm.fields_dict['indent_no'].get_query = function(doc) { - return{ - filters:[ - ['Material Request', 'material_request_type', '=', 'Purchase'], - ['Material Request', 'company', '=', doc.company], - ['Material Request', 'docstatus', '=', 1], - ['Material Request', 'status', '!=', 'Stopped'], - ['Material Request', 'per_ordered', '<', 99.99] - ] - } -} - cur_frm.cscript.supplier_address = function(doc, dt, dn) { if (doc.supplier) { get_server_fields("get_supplier_address", JSON.stringify({supplier: doc.supplier, @@ -102,4 +90,4 @@ cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) { return { filters:{'supplier': doc.supplier} } -} +} \ No newline at end of file diff --git a/hr/doctype/appraisal/appraisal.js b/hr/doctype/appraisal/appraisal.js index ac2b1234d2..2289064baa 100644 --- a/hr/doctype/appraisal/appraisal.js +++ b/hr/doctype/appraisal/appraisal.js @@ -84,7 +84,5 @@ cur_frm.cscript.calculate_total = function(doc,cdt,cdn){ } cur_frm.fields_dict.employee.get_query = function(doc,cdt,cdn) { - return{ - query:"controllers.queries.employee_query" - } + return{ query:"controllers.queries.employee_query" } } \ No newline at end of file diff --git a/hr/doctype/salary_structure/salary_structure.js b/hr/doctype/salary_structure/salary_structure.js index 065bb47711..60c159dd46 100644 --- a/hr/doctype/salary_structure/salary_structure.js +++ b/hr/doctype/salary_structure/salary_structure.js @@ -73,7 +73,5 @@ cur_frm.cscript.validate = function(doc, cdt, cdn) { } cur_frm.fields_dict.employee.get_query = function(doc,cdt,cdn) { - return{ - query:"controllers.queries.employee_query" - } + return{ query:"controllers.queries.employee_query" } } \ No newline at end of file diff --git a/manufacturing/doctype/production_order/production_order.js b/manufacturing/doctype/production_order/production_order.js index e3518591b3..7dc905a536 100644 --- a/manufacturing/doctype/production_order/production_order.js +++ b/manufacturing/doctype/production_order/production_order.js @@ -106,16 +106,12 @@ cur_frm.fields_dict['production_item'].get_query = function(doc) { ['Item', 'is_pro_applicable', '=', 'Yes'] ] } - // return 'SELECT DISTINCT `tabItem`.`name`, `tabItem`.`description` FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND `tabItem`.docstatus != 2 AND `tabItem`.is_pro_applicable = "Yes" AND `tabItem`.%(key)s LIKE "%s" ORDER BY `tabItem`.`name` LIMIT 50'; } cur_frm.fields_dict['project_name'].get_query = function(doc, dt, dn) { return{ filters:['Project', 'status', 'not in', 'Completed, Cancelled'] } - // return 'SELECT `tabProject`.name FROM `tabProject` \ - // WHERE `tabProject`.status not in ("Completed", "Cancelled") \ - // AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50'; } diff --git a/projects/doctype/task/task.js b/projects/doctype/task/task.js index 097119ffb6..cb2c539d63 100644 --- a/projects/doctype/task/task.js +++ b/projects/doctype/task/task.js @@ -22,7 +22,7 @@ erpnext.projects.Task = wn.ui.form.Controller.extend({ setup: function() { this.frm.fields_dict.project.get_query = function() { return { - query: "projects.doctype.tast.task.get_project" + query: "projects.doctype.task.task.get_project" } }; }, diff --git a/projects/doctype/task/task.py b/projects/doctype/task/task.py index 1dfcdc1af1..0072b1f70d 100644 --- a/projects/doctype/task/task.py +++ b/projects/doctype/task/task.py @@ -96,7 +96,7 @@ def get_events(start, end, filters=None): def get_project(doctype, txt, searchfield, start, page_len, filters): from controllers.queries import get_match_cond return webnotes.conn.sql(""" select name from `tabProject` - where %(key)s like %(txt)s %(mcond)s + where %(key)s like "%(txt)s" %(mcond)s order by name limit %(start)s, %(page_len)s """ % {'key': searchfield, 'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield), diff --git a/selling/doctype/customer/customer.js b/selling/doctype/customer/customer.js index f92a2a90e6..cd530a25ba 100644 --- a/selling/doctype/customer/customer.js +++ b/selling/doctype/customer/customer.js @@ -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'; } diff --git a/selling/doctype/installation_note/installation_note.js b/selling/doctype/installation_note/installation_note.js index 8574da3123..4cbd67d729 100644 --- a/selling/doctype/installation_note/installation_note.js +++ b/selling/doctype/installation_note/installation_note.js @@ -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) { diff --git a/selling/doctype/opportunity/opportunity.js b/selling/doctype/opportunity/opportunity.js index f88402d882..b87fee196d 100644 --- a/selling/doctype/opportunity/opportunity.js +++ b/selling/doctype/opportunity/opportunity.js @@ -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" } } diff --git a/selling/doctype/quotation/quotation.js b/selling/doctype/quotation/quotation.js index ccb4998eaf..cfaf61172a 100644 --- a/selling/doctype/quotation/quotation.js +++ b/selling/doctype/quotation/quotation.js @@ -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}); } } diff --git a/selling/doctype/sales_bom/sales_bom.js b/selling/doctype/sales_bom/sales_bom.js index f60b6e3122..7d79340678 100644 --- a/selling/doctype/sales_bom/sales_bom.js +++ b/selling/doctype/sales_bom/sales_bom.js @@ -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'; diff --git a/setup/doctype/authorization_rule/authorization_rule.js b/setup/doctype/authorization_rule/authorization_rule.js index 76a87080c3..1866cbcc5d 100644 --- a/setup/doctype/authorization_rule/authorization_rule.js +++ b/setup/doctype/authorization_rule/authorization_rule.js @@ -97,8 +97,6 @@ cur_frm.fields_dict['system_role'].get_query = function(doc) { ['Role', 'name', 'not in', 'Administrator, Guest, All'] ] } - - // return 'SELECT tabRole.name FROM tabRole WHERE tabRole.name not in ("Administrator","Guest","All") AND tabRole.%(key)s LIKE "%s" LIMIT 50' } // Approving Role Trigger @@ -117,19 +115,16 @@ cur_frm.fields_dict['master_name'].get_query = function(doc){ ['Customer', 'docstatus', '!=', 2] ] } - // return 'SELECT `tabCustomer`.`name` FROM `tabCustomer` WHERE `tabCustomer`.docstatus !=2 and `tabCustomer`.`name` LIKE "%s" ORDER BY `tabCustomer`.`name` DESC LIMIT 50'; else if(doc.based_on == 'Itemwise Discount') return { query: "controllers.queries.item_query" } - // return 'SELECT `tabItem`.`name` FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) and `tabItem`.is_sales_item = "Yes" and tabItem.%(key)s LIKE "%s" ORDER BY `tabItem`.`name` DESC LIMIT 50'; else return { filters: [ ['Item', 'name', '=', 'cheating done to avoid null'] ] } - // return 'SELECT `tabItem`.`name` FROM `tabItem` WHERE `tabItem`.`name` = "cheating done to avoid null" ORDER BY `tabItem`.`name` DESC LIMIT 50'; } cur_frm.fields_dict.to_emp.get_query = function(doc,cdt,cdn) { diff --git a/setup/doctype/company/company.js b/setup/doctype/company/company.js index 60a32ae10a..dfe8e2ae87 100644 --- a/setup/doctype/company/company.js +++ b/setup/doctype/company/company.js @@ -55,13 +55,8 @@ cur_frm.fields_dict.default_bank_account.get_query = function(doc) { 'account_type': "Bank or Cash" } } - // return 'SELECT `tabAccount`.name, `tabAccount`.debit_or_credit, `tabAccount`.group_or_ledger FROM `tabAccount` WHERE `tabAccount`.company = "'+doc.name+'" AND `tabAccount`.group_or_ledger = "Ledger" AND `tabAccount`.docstatus != 2 AND `tabAccount`.account_type = "Bank or Cash" AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50'; } -// cur_frm.fields_dict.default_cash_account.get_query = function(doc) { -// return 'SELECT `tabAccount`.name, `tabAccount`.debit_or_credit, `tabAccount`.group_or_ledger FROM `tabAccount` WHERE `tabAccount`.company = "'+doc.name+'" AND `tabAccount`.group_or_ledger = "Ledger" AND `tabAccount`.docstatus != 2 AND `tabAccount`.account_type = "Bank or Cash" AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50'; -// } - cur_frm.fields_dict.payables_group.get_query = cur_frm.fields_dict.receivables_group.get_query; cur_frm.fields_dict.receivables_group.get_query = function(doc) { @@ -71,17 +66,11 @@ cur_frm.fields_dict.receivables_group.get_query = function(doc) { 'group_or_ledger': "Group" } } - // return 'SELECT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.company = "'+doc.name+'" AND `tabAccount`.group_or_ledger = "Group" AND `tabAccount`.docstatus != 2 AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50'; } -// cur_frm.fields_dict.payables_group.get_query = function(doc) { -// return 'SELECT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.company = "'+doc.name+'" AND `tabAccount`.group_or_ledger = "Group" AND `tabAccount`.docstatus != 2 AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50'; -// } - if (sys_defaults.auto_inventory_accounting) { cur_frm.fields_dict["stock_in_hand_account"].get_query = function(doc) { return { - // "query": "accounts.utils.get_account_list", "filters": { "is_pl_account": "No", "debit_or_credit": "Debit", @@ -93,7 +82,6 @@ if (sys_defaults.auto_inventory_accounting) { cur_frm.fields_dict["stock_adjustment_account"].get_query = function(doc) { return { - // "query": "accounts.utils.get_account_list", "filters": { "is_pl_account": "Yes", "debit_or_credit": "Debit", @@ -108,7 +96,6 @@ if (sys_defaults.auto_inventory_accounting) { cur_frm.fields_dict["stock_received_but_not_billed"].get_query = function(doc) { return { - // "query": "accounts.utils.get_account_list", "filters": { "is_pl_account": "No", "debit_or_credit": "Credit", @@ -120,7 +107,6 @@ if (sys_defaults.auto_inventory_accounting) { cur_frm.fields_dict["stock_adjustment_cost_center"].get_query = function(doc) { return { - // "query": "accounts.utils.get_cost_center_list", "filters": {"company": doc.name} } } diff --git a/setup/doctype/contact_control/contact_control.js b/setup/doctype/contact_control/contact_control.js index 9d4d8bf94c..db0ed91bfd 100755 --- a/setup/doctype/contact_control/contact_control.js +++ b/setup/doctype/contact_control/contact_control.js @@ -26,10 +26,9 @@ if(cur_frm.fields_dict['territory']){ cur_frm.fields_dict['territory'].get_query = function(doc,dt,dn) { return { filters: { - 'is_group' = "No" + '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'; } } diff --git a/setup/doctype/customer_group/customer_group.js b/setup/doctype/customer_group/customer_group.js index 18931eb071..e865860a24 100644 --- a/setup/doctype/customer_group/customer_group.js +++ b/setup/doctype/customer_group/customer_group.js @@ -36,8 +36,4 @@ cur_frm.fields_dict['parent_customer_group'].get_query = function(doc,cdt,cdn) { 'is_group': "Yes" } } - // return 'SELECT `tabCustomer Group`.`name`,`tabCustomer Group`.`parent_customer_group` \ - // FROM `tabCustomer Group` WHERE `tabCustomer Group`.`is_group` = "Yes" AND \ - // `tabCustomer Group`.`docstatus`!= 2 AND `tabCustomer Group`.%(key)s LIKE "%s" \ - // ORDER BY `tabCustomer Group`.`name` ASC LIMIT 50'; } \ No newline at end of file diff --git a/setup/doctype/item_group/item_group.js b/setup/doctype/item_group/item_group.js index 581039370b..b642735215 100644 --- a/setup/doctype/item_group/item_group.js +++ b/setup/doctype/item_group/item_group.js @@ -40,5 +40,4 @@ cur_frm.fields_dict['parent_item_group'].get_query = function(doc,cdt,cdn) { ['Item Group', 'naem', '!=', doc.item_group_name] ] } - // return 'SELECT `tabItem Group`.`name`,`tabItem Group`.`parent_item_group` FROM `tabItem Group` WHERE `tabItem Group`.`is_group` = "Yes" AND `tabItem Group`.`docstatus`!= 2 AND `tabItem Group`.`name` !="'+doc.item_group_name+'" AND `tabItem Group`.%(key)s LIKE "%s" ORDER BY `tabItem Group`.`name` ASC LIMIT 50'; } \ No newline at end of file diff --git a/setup/doctype/sales_partner/sales_partner.js b/setup/doctype/sales_partner/sales_partner.js index 5db60c5951..acf6b312bd 100644 --- a/setup/doctype/sales_partner/sales_partner.js +++ b/setup/doctype/sales_partner/sales_partner.js @@ -100,5 +100,4 @@ cur_frm.fields_dict['partner_target_details'].grid.get_field("item_group").get_q return{ filters:{ 'is_group': "No" } } - // return 'SELECT `tabItem Group`.`name`,`tabItem Group`.`parent_item_group` FROM `tabItem Group` WHERE `tabItem Group`.is_group="No" AND `tabItem Group`.docstatus != 2 AND `tabItem Group`.%(key)s LIKE "%s" LIMIT 50' } \ No newline at end of file diff --git a/setup/doctype/sales_person/sales_person.js b/setup/doctype/sales_person/sales_person.js index e0d06395e0..fd03a441ee 100644 --- a/setup/doctype/sales_person/sales_person.js +++ b/setup/doctype/sales_person/sales_person.js @@ -41,14 +41,12 @@ cur_frm.fields_dict['parent_sales_person'].get_query = function(doc,cdt,cdn) { ['Sales Person', 'name', '!=', doc.sales_person_name] ] } - // return 'SELECT `tabSales Person`.`name`,`tabSales Person`.`parent_sales_person` FROM `tabSales Person` WHERE `tabSales Person`.`is_group` = "Yes" AND `tabSales Person`.`docstatus`!= 2 AND `tabSales Person`.`name` !="'+doc.sales_person_name+'" AND `tabSales Person`.%(key)s LIKE "%s" ORDER BY `tabSales Person`.`name` ASC LIMIT 50'; } cur_frm.fields_dict['target_details'].grid.get_field("item_group").get_query = function(doc, cdt, cdn) { return{ filters:{ 'is_group': "No" } } - // return 'SELECT `tabItem Group`.name FROM `tabItem Group` WHERE `tabItem Group`.is_group="No" AND `tabItem Group`.docstatus != 2 AND `tabItem Group`.%(key)s LIKE "%s" LIMIT 50' } cur_frm.fields_dict.employee.get_query = function(doc,cdt,cdn) { diff --git a/setup/doctype/territory/territory.js b/setup/doctype/territory/territory.js index 3164ba279d..7fdfee54d6 100644 --- a/setup/doctype/territory/territory.js +++ b/setup/doctype/territory/territory.js @@ -36,7 +36,6 @@ cur_frm.fields_dict['parent_territory'].get_query = function(doc,cdt,cdn) { ['Territory', 'name', '!=', doc.territory_name] ] } - // return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "Yes" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.`name` !="'+doc.territory_name+'" AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50'; } @@ -45,5 +44,4 @@ cur_frm.fields_dict['target_details'].grid.get_field("item_group").get_query = f return{ filters:{ 'is_group': "No"} } -// return 'SELECT `tabItem Group`.`name`,`tabItem Group`.`parent_item_group` FROM `tabItem Group` WHERE `tabItem Group`.is_group="No" AND `tabItem Group`.docstatus != 2 AND `tabItem Group`.%(key)s LIKE "%s" LIMIT 50' } diff --git a/stock/doctype/item/item.js b/stock/doctype/item/item.js index a0937fb285..3d427ad311 100644 --- a/stock/doctype/item/item.js +++ b/stock/doctype/item/item.js @@ -57,7 +57,6 @@ cur_frm.fields_dict['default_bom'].get_query = function(doc) { 'is_active': 0 } } - // return 'SELECT DISTINCT `tabBOM`.`name` FROM `tabBOM` WHERE `tabBOM`.`item` = "' + doc.item_code + '" AND ifnull(`tabBOM`.`is_active`, 0) = 0 and `tabBOM`.docstatus != 2 AND `tabBOM`.%(key)s LIKE "%s" ORDER BY `tabBOM`.`name` LIMIT 50' } diff --git a/stock/doctype/landed_cost_wizard/landed_cost_wizard.js b/stock/doctype/landed_cost_wizard/landed_cost_wizard.js index 86787cac65..a093d6f264 100644 --- a/stock/doctype/landed_cost_wizard/landed_cost_wizard.js +++ b/stock/doctype/landed_cost_wizard/landed_cost_wizard.js @@ -28,5 +28,4 @@ return{ ['Account', 'debit_or_credit', '=', 'Debit'] ] } - // return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND (tabAccount.account_type = "Tax" OR tabAccount.account_type = "Chargeable" or (tabAccount.is_pl_account = "Yes" and tabAccount.debit_or_credit = "Debit")) AND tabAccount.name LIKE "%s"'; } diff --git a/stock/doctype/packing_slip/packing_slip.js b/stock/doctype/packing_slip/packing_slip.js index b658220a1c..e19ab49300 100644 --- a/stock/doctype/packing_slip/packing_slip.js +++ b/stock/doctype/packing_slip/packing_slip.js @@ -18,7 +18,6 @@ cur_frm.fields_dict['delivery_note'].get_query = function(doc, cdt, cdn) { return{ filters:{ 'docstatus': 0} } - // return 'SELECT name FROM `tabDelivery Note` WHERE docstatus=0 AND %(key)s LIKE "%s"'; } diff --git a/stock/doctype/serial_no/serial_no.js b/stock/doctype/serial_no/serial_no.js index df7058a951..0253ffbe83 100644 --- a/stock/doctype/serial_no/serial_no.js +++ b/stock/doctype/serial_no/serial_no.js @@ -49,7 +49,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'; } // Supplier diff --git a/support/doctype/customer_issue/customer_issue.js b/support/doctype/customer_issue/customer_issue.js index 1f68602684..cd744ec121 100644 --- a/support/doctype/customer_issue/customer_issue.js +++ b/support/doctype/customer_issue/customer_issue.js @@ -68,17 +68,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['serial_no'].get_query = function(doc, cdt, cdn) { @@ -110,10 +105,6 @@ cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) { return{ filters:{ 'serial_no': doc.serial_no} } - // return 'SELECT `tabSerial No`.item_code, `tabSerial No`.description \ - // FROM `tabSerial No` \ - // WHERE `tabSerial No`.docstatus != 2 AND `tabSerial No`.name = "' + doc.serial_no + - // '" AND `tabSerial No`.item_code LIKE "%s" ORDER BY `tabSerial No`.item_code ASC LIMIT 50'; } else{ return{ @@ -121,9 +112,6 @@ cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) { ['Item', 'docstatus', '!=', 2] ] } - // return 'SELECT `tabItem`.name, `tabItem`.item_name, `tabItem`.description \ - // FROM `tabItem` \ - // WHERE `tabItem`.docstatus != 2 AND `tabItem`.%(key)s LIKE "%s" ORDER BY `tabItem`.name ASC LIMIT 50'; } } @@ -134,10 +122,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.customer.get_query = function(doc,cdt,cdn) {