Hello, I’m trying to create a Multi Select Dialog. I’m in the DocType Transportation Trip
this model has a Child Table packages
which itself fetches packages form a DocType named Package
.
I want to create a Multi Select Dialog, that lists the packages I want to add to the Child Table Packages. Here’s the code:
// MultiSelectDialog with custom query method
let query_args = {
//Backend method that get's called and returns the packages elegible
query:"package_management.package_management.doctype.package.package.get_packages_for_trip",
filters: { docstatus: ["!=", 2]}
}
function quickPackageEntry() {
new frappe.ui.form.MultiSelectDialog({
doctype: "Package",
// Here's my problem
target: cur_frm,
setters: {
"state": "planned",
"driver": "planned"
},
date_field: "received_date",
get_query() {
return query_args;
},
action(selections) {
console.log(selections);
}
});
}
My problem is that when the MultiSelect dialog appears, the setters come from the current form/DocType, So stat and driver, show the option from the state and driver of the current form and not of the DocType Package which is what I specify.
My problem is how do I instead of passing cur_frm, get the frm object for the DocType Package?
Thanks!