Auto set default bank/cash account on select of Bank/Cash Voucher in JV
This commit is contained in:
parent
6e06357dc5
commit
f5804438bb
@ -213,10 +213,11 @@ cur_frm.cscript.voucher_type = function(doc, cdt, cdn) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var update_jv_details = function(doc, r) {
|
var update_jv_details = function(doc, r) {
|
||||||
$.each(r.message, function(i, d) {
|
var jvdetail = frappe.model.add_child(doc, "Journal Voucher Detail", "entries");
|
||||||
var jvdetail = frappe.model.add_child(doc, "Journal Voucher Detail", "entries");
|
$.each(r, function(i, d) {
|
||||||
jvdetail.account = d.account;
|
var row = frappe.model.add_child(doc, "Journal Voucher Detail", "entries");
|
||||||
jvdetail.balance = d.balance;
|
row.account = d.account;
|
||||||
|
row.balance = d.balance;
|
||||||
});
|
});
|
||||||
refresh_field("entries");
|
refresh_field("entries");
|
||||||
}
|
}
|
||||||
@ -231,7 +232,7 @@ cur_frm.cscript.voucher_type = function(doc, cdt, cdn) {
|
|||||||
},
|
},
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
if(r.message) {
|
if(r.message) {
|
||||||
update_jv_details(doc, r);
|
update_jv_details(doc, [r.message]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -245,7 +246,7 @@ cur_frm.cscript.voucher_type = function(doc, cdt, cdn) {
|
|||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
frappe.model.clear_table(doc, "entries");
|
frappe.model.clear_table(doc, "entries");
|
||||||
if(r.message) {
|
if(r.message) {
|
||||||
update_jv_details(doc, r);
|
update_jv_details(doc, r.message);
|
||||||
}
|
}
|
||||||
cur_frm.set_value("is_opening", "Yes")
|
cur_frm.set_value("is_opening", "Yes")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user