mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-03 12:19:12 +00:00
fixes: make payment entry from sales invoice
This commit is contained in:
@@ -307,35 +307,27 @@ cur_frm.cscript['Make Delivery Note'] = function() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cur_frm.cscript.make_bank_voucher = function() {
|
||||||
|
wn.call({
|
||||||
// Make Bank Voucher Button
|
method: "accounts.doctype.journal_voucher.journal_voucher.get_default_bank_cash_account",
|
||||||
// -------------------------
|
args: {
|
||||||
cur_frm.cscript.make_bank_voucher = function(doc, dt, dn) {
|
"company": cur_frm.doc.company,
|
||||||
$c('accounts.get_default_bank_account', { company: cur_frm.doc.company }, function(r, rt) {
|
"voucher_type": "Bank Voucher"
|
||||||
if(!r.exc) {
|
},
|
||||||
cur_frm.cscript.make_jv(cur_frm.doc, null, null, r.message);
|
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) {
|
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"'
|
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) {
|
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"'
|
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) {
|
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"'
|
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
|
// credit to bank
|
||||||
var d1 = wn.model.add_child(jv, 'Journal Voucher Detail', 'entries');
|
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.debit = doc.outstanding_amount;
|
||||||
|
d1.balance = bank_account.balance;
|
||||||
|
|
||||||
loaddoc('Journal Voucher', jv.name);
|
loaddoc('Journal Voucher', jv.name);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user