i have lots of branch. i have button called Get All Active branches. when i click on this button, i should get all the active branches in below table.
the error is:
my assign_branch.py code:
#Populate branches with active branches
def get_all_branches(self):
query = "select name as branch from tabBranch where is_disabled != 1"
entries = frappe.db.sql(query, as_dict=True)
self.set('items', [])
for d in entries:
row = self.append('items', {})
row.update(d)
.js code:
cur_frm.add_fetch(“employee”, “user_id”, “user”)
cur_frm.add_fetch(“employee”, “branch”, “current_branch”)
frappe.ui.form.on(‘Assign Branch’, {
refresh: function(frm) {
},
get_all_branch: function(frm) {
//load_accounts(frm.doc.company)
return frappe.call({
method: "get_all_branches",
doc: frm.doc,
callback: function(r, rt) {
frm.refresh_field("items");
frm.refresh_fields();
}
});
}
});