Hi @jf888,
Please check the scenario and then apply the client script for it.
Client Script Code:
frappe.ui.form.on('Sales Invoice', {
refresh: function (frm) {
frm.add_custom_button(__('Get Expense Claims'), function () {
new frappe.ui.form.MultiSelectDialog({
doctype: "Expense Claim",
size: 'large',
target: frm,
setters: [{
label: ('Status'),
fieldname: 'status',
fieldtype: 'Select',
options: '\nDraft\nPaid\nUnpaid\nRejected\nSubmitted\nCancelled',
},
{
label: ('Project'),
fieldname: 'project',
fieldtype: 'Link',
options: "Project",
default: frm.doc.project
},
{
label: ('Total Claimed Amount'),
fieldname: 'total_claimed_amount',
fieldtype: 'Currency',
hidden: 1
},
{
label: ('Total Sanctioned Amount'),
fieldname: 'total_sanctioned_amount',
fieldtype: 'Currency',
hidden: 1
}
],
get_query() {
return {
filters: {}
};
},
action(selections) {
if (selections && selections.length > 0) {
$.each(selections, function (i, expense_claim) {
frm.add_child("sales_invoice_expense_claim", {
expense_claim: expense_claim,
});
});
frm.refresh_field("sales_invoice_expense_claim");
$(".modal").modal("hide");
}
}
});
});
}
});
Please set your field according.
I hope this helps.
Thank You!