From 8803df04ccc9ed1cf39d104d75bcd4e9f41926c1 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 19 Mar 2013 18:53:00 +0530 Subject: [PATCH] aii: get_query for default account in company --- setup/doctype/company/company.js | 40 ++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/setup/doctype/company/company.js b/setup/doctype/company/company.js index a84bbc97141..a89882347e9 100644 --- a/setup/doctype/company/company.js +++ b/setup/doctype/company/company.js @@ -58,3 +58,43 @@ cur_frm.fields_dict.receivables_group.get_query = function(doc) { 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'; } + + +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", + "company": doc.name + } + } +} + +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", + "company": doc.name + } + } +} + +cur_frm.fields_dict["expenses_included_in_valuation"].get_query = + cur_frm.fields_dict["stock_adjustment_account"].get_query; + +cur_frm.fields_dict["stock_delivered_but_not_billed"].get_query = + cur_frm.fields_dict["stock_in_hand_account"].get_query; + +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", + "company": doc.name + } + } +} \ No newline at end of file