frappe.ui.form.on('Sales Invoice', {
refresh: function(frm) {
frm.add_custom_button(__('Issue'), function(){
new frappe.ui.form.MultiSelectDialog({
doctype: "Issue",
target: frm,
setters: {},
get_query() {
return {
filters: { status: 'Closed' }
}
},
action(selections) {
if (selections && selections.length > 0) {
$.each(selections, function (i,custom_item) {
console.log(custom_item);
frappe.db.get_list('Issue', {
fields: ['customer','custom_item.itemss','custom_item.qty'],
filters: {"name":custom_item}
}).then(records => {
console.log(records);
frm.set_value("customer",records[0].customer)
frm.clear_table("items");
frm.add_child("items",{
item_code: records[0].itemss,
qty:records[0].qty
});
frm.refresh_field("items");
frm.refresh_field("customer");
})
});
$(".modal").modal("hide");
}
}
});
}, __("Get Items From"));
}
});
After getting the items and qty which is automatically bind the calculations is not taking place