[accounts] [feature] added default_cash_account in company and gets set in Journal Voucher

This commit is contained in:
Rushabh Mehta 2013-03-25 15:48:57 +05:30
parent df8b652402
commit 2f8ad5e5c1
2 changed files with 9 additions and 2 deletions

View File

@ -153,7 +153,8 @@ cur_frm.cscript.voucher_type = function(doc, cdt, cdn) {
callback: function(r) {
if(r.message) {
var jvdetail = wn.model.add_child(doc, "Journal Voucher Detail", "entries");
jvdetail.account = r.message || "";
jvdetail.account = r.message.account;
jvdetail.balance = r.message.balance;
refresh_field("entries");
}
}

View File

@ -351,8 +351,14 @@ class DocType(AccountsController):
@webnotes.whitelist()
def get_default_bank_cash_account(company, voucher_type):
return webnotes.conn.get_value("Company", company,
from accounts.utils import get_balance_on
account = webnotes.conn.get_value("Company", company,
voucher_type=="Bank Voucher" and "default_bank_account" or "default_cash_account")
if account:
return {
"account": account,
"balance": get_balance_on(account)
}
def get_against_purchase_invoice(doctype, txt, searchfield, start, page_len, filters):
return webnotes.conn.sql("""select name, credit_to, outstanding_amount, bill_no, bill_date