Hello;
Appreciate if someone can advise me when setup method is executed? Based on what?
Example code is below (from payment_entry.js):
setup: function(frm) { frm.set_query("paid_from", function() { var party_account_type = in_list(["Customer", "Student"], frm.doc.party_type) ? "Receivable" : "Payable"; var account_types = in_list(["Pay", "Internal Transfer"], frm.doc.payment_type) ? ["Bank", "Cash"] : party_account_type; return { filters: { "account_type": ["in", account_types], "is_group": 0, "company": frm.doc.company } } }); frm.set_query("party_type", function() { return{ "filters": { "name": ["in",["Customer","Supplier", "Employee", "Student"]], } } }); frm.set_query("paid_to", function() { var party_account_type = in_list(["Customer", "Student"], frm.doc.party_type) ? "Receivable" : "Payable"; var account_types = in_list(["Receive", "Internal Transfer"], frm.doc.payment_type) ? ["Bank", "Cash"] : party_account_type; return { filters: { "account_type": ["in", account_types], "is_group": 0, "company": frm.doc.company } } });
Regards
Bilal