fixes: make payment entry from sales invoice

This commit is contained in:
Nabin Hait 2013-03-26 15:03:13 +05:30
parent 6c49b57602
commit b3b335c89e

View File

@ -307,35 +307,27 @@ cur_frm.cscript['Make Delivery Note'] = function() {
);
}
// Make Bank Voucher Button
// -------------------------
cur_frm.cscript.make_bank_voucher = function(doc, dt, dn) {
$c('accounts.get_default_bank_account', { company: cur_frm.doc.company }, function(r, rt) {
if(!r.exc) {
cur_frm.cscript.make_jv(cur_frm.doc, null, null, r.message);
cur_frm.cscript.make_bank_voucher = function() {
wn.call({
method: "accounts.doctype.journal_voucher.journal_voucher.get_default_bank_cash_account",
args: {
"company": cur_frm.doc.company,
"voucher_type": "Bank Voucher"
},
callback: function(r) {
cur_frm.cscript.make_jv(cur_frm.doc, null, null, r.message);
}
});
}
/* ***************************** Get Query Functions ************************** */
// Debit To
// ---------
cur_frm.fields_dict.debit_to.get_query = function(doc) {
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"'
}
// Cash/bank account
//------------------
cur_frm.fields_dict.cash_bank_account.get_query = function(doc) {
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"'
}
// Write off account
//------------------
cur_frm.fields_dict.write_off_account.get_query = function(doc) {
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"'
}
@ -488,8 +480,9 @@ cur_frm.cscript.make_jv = function(doc, dt, dn, bank_account) {
// credit to bank
var d1 = wn.model.add_child(jv, 'Journal Voucher Detail', 'entries');
d1.account = bank_account;
d1.account = bank_account.account;
d1.debit = doc.outstanding_amount;
d1.balance = bank_account.balance;
loaddoc('Journal Voucher', jv.name);
}