Background:
I have created a custom JV entry type which automatically adds some accounts in the JV (like bank entry):
frappe.ui.form.on("Journal Entry", "voucher_type", function(frm, cdt, cdn) {
if((!(frm.doc.accounts || []).length) || ((frm.doc.accounts || []).length==1 && !frm.doc.accounts[0].account)) {
if(frm.doc.voucher_type=="GTA Expense Entry") {
frappe.model.clear_table(frm.doc, "accounts");
var list_of_accounts = [
"Freight Outward - SMC",
"Creditors - SMC",
"GTA Service Tax 14% - SMC",
"GTA Krishi Kalyan Cess 0.5% - SMC",
"GTA Swachh Bharat Cess 0.5% - SMC"
];
$.each(list_of_accounts, function(index, value) {
var row = frappe.model.add_child(frm.doc, "Journal Entry Account", "accounts");
row.account = value;
});
refresh_field("accounts");
}
}
});
Issue:
I want the party query to populate for the creditors account but I tried some code and I can’t make it work.
Any help is appreciated. Thanks.