From b9e8a41cd2f5e1a9d32ea68bffb85511b9ecc35d Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 21 Dec 2011 17:33:57 +0530 Subject: [PATCH] Account and cost center get_query changes for other charges table --- .../purchase_other_charges/purchase_other_charges.js | 11 +++++------ erpnext/setup/doctype/other_charges/other_charges.js | 8 +++----- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/erpnext/buying/doctype/purchase_other_charges/purchase_other_charges.js b/erpnext/buying/doctype/purchase_other_charges/purchase_other_charges.js index 9222997e9a2..d9735b61f35 100644 --- a/erpnext/buying/doctype/purchase_other_charges/purchase_other_charges.js +++ b/erpnext/buying/doctype/purchase_other_charges/purchase_other_charges.js @@ -111,15 +111,14 @@ cur_frm.cscript.row_id = function(doc, cdt, cdn) { /*---------------------- Get rate if account_head has account_type as TAX or CHARGEABLE-------------------------------------*/ cur_frm.fields_dict['purchase_tax_details'].grid.get_field("account_head").get_query = function(doc,cdt,cdn) { - 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"' + 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.company = "' + doc.company + '" AND tabAccount.name LIKE "%s"' } -//--------------------filter other charges master company-wise----------------------------------------- -/* -cur_frm.fields_dict.charge.get_query = function(doc) { - return 'SELECT DISTINCT `tabOther Charges`.name FROM `tabOther Charges` WHERE `tabOther Charges`.company = "'+doc.company+'" AND `tabOther Charges`.company is not NULL AND `tabOther Charges`.docstatus !=2 AND `tabOther Charges`.name LIKE "%s" ORDER BY `tabOther Charges`.name LIMIT 50'; + +cur_frm.fields_dict['purchase_tax_details'].grid.get_field("cost_center").get_query = function(doc) { + 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'; } -*/ + cur_frm.cscript.account_head = function(doc, cdt, cdn) { var d = locals[cdt][cdn]; diff --git a/erpnext/setup/doctype/other_charges/other_charges.js b/erpnext/setup/doctype/other_charges/other_charges.js index 3d0b3244c45..4c154f529e1 100644 --- a/erpnext/setup/doctype/other_charges/other_charges.js +++ b/erpnext/setup/doctype/other_charges/other_charges.js @@ -93,12 +93,10 @@ cur_frm.fields_dict['other_charges'].grid.get_field("account_head").get_query = 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") AND tabAccount.company = "'+doc.company+'" AND tabAccount.name LIKE "%s"' } -//--------------------filter other charges master company-wise----------------------------------------- -/* -cur_frm.fields_dict.charge.get_query = function(doc) { - return 'SELECT DISTINCT `tabOther Charges`.name FROM `tabOther Charges` WHERE `tabOther Charges`.company = "'+doc.company+'" AND `tabOther Charges`.company is not NULL AND `tabOther Charges`.name LIKE "%s" ORDER BY `tabOther Charges`.name LIMIT 50'; +cur_frm.fields_dict['other_charges'].grid.get_field("cost_center_other_charges").get_query = function(doc) { + 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'; } -*/ + cur_frm.cscript.account_head = function(doc, cdt, cdn) { var d = locals[cdt][cdn];