fix(autocomplete): give Installed Applications as a option
This commit is contained in:
parent
3e137957c2
commit
541f8f3360
2 changed files with 18 additions and 15 deletions
|
|
@ -1,19 +1,8 @@
|
|||
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on("Desktop Icon", {
|
||||
setup: function (frm) {
|
||||
load_installed_apps();
|
||||
},
|
||||
});
|
||||
// frappe.ui.form.on("Desktop Icon", {
|
||||
// setup: function (frm) {
|
||||
|
||||
async function load_installed_apps(frm) {
|
||||
await frappe.call({
|
||||
method: "frappe.desk.desktop.get_installed_apps",
|
||||
callback: function (r) {
|
||||
if (r.message) {
|
||||
cur_frm.fields_dict["app"].set_data(r.message);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
// },
|
||||
// });
|
||||
|
|
|
|||
|
|
@ -11,6 +11,9 @@ frappe.ui.form.ControlAutocomplete = class ControlAutoComplete extends frappe.ui
|
|||
set_options() {
|
||||
if (this.df.options) {
|
||||
let options = this.df.options || [];
|
||||
if (options == "Installed Applications") {
|
||||
this.load_installed_apps();
|
||||
}
|
||||
this.set_data(options);
|
||||
}
|
||||
}
|
||||
|
|
@ -241,4 +244,15 @@ frappe.ui.form.ControlAutocomplete = class ControlAutoComplete extends frappe.ui
|
|||
}
|
||||
this._data = data;
|
||||
}
|
||||
|
||||
async load_installed_apps(frm) {
|
||||
await frappe.call({
|
||||
method: "frappe.desk.desktop.get_installed_apps",
|
||||
callback: function (r) {
|
||||
if (r.message) {
|
||||
cur_frm.fields_dict["app"].set_data(r.message);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue