chore: fix Select dropdown options loading from Settings
This commit is contained in:
parent
7243188e97
commit
e84b04ddd8
2 changed files with 19 additions and 32 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
# Service Factory — ERPNext Custom App Project
|
# Service Factory — ERPNext Custom App Project
|
||||||
|
|
||||||
> **Current Version: V0.1.0017** — Each completed prompt/step increments the patch number by 1 (V0.1.0000 → V0.1.0001 → V0.1.0002…). The agent automatically commits and pushes after every step.
|
> **Current Version: V0.1.0018** — Each completed prompt/step increments the patch number by 1 (V0.1.0000 → V0.1.0001 → V0.1.0002…). The agent automatically commits and pushes after every step.
|
||||||
|
|
||||||
## Project Overview
|
## Project Overview
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,7 @@
|
||||||
|
|
||||||
frappe.ui.form.on("Engagement Card", {
|
frappe.ui.form.on("Engagement Card", {
|
||||||
refresh: function (frm) {
|
refresh: function (frm) {
|
||||||
// Load dynamic options from Settings
|
load_select_options(frm);
|
||||||
load_options(frm);
|
|
||||||
|
|
||||||
// Quick status actions
|
// Quick status actions
|
||||||
if (frm.doc.status === "Discovery") {
|
if (frm.doc.status === "Discovery") {
|
||||||
frm.add_custom_button(__("Move to Delivery"), function () {
|
frm.add_custom_button(__("Move to Delivery"), function () {
|
||||||
|
|
@ -66,43 +64,32 @@ frappe.ui.form.on("Engagement Card", {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
function load_options(frm) {
|
function load_select_options(frm) {
|
||||||
// Fetch task options from Settings
|
|
||||||
frappe.call({
|
|
||||||
method: "frappe.client.get_single_value",
|
|
||||||
args: {
|
|
||||||
doctype: "Service Factory Settings",
|
|
||||||
},
|
|
||||||
callback: function (r) {
|
|
||||||
if (!r.message) return;
|
|
||||||
|
|
||||||
// Get task types - need full doc for table fields
|
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: "frappe.client.get",
|
method: "frappe.client.get",
|
||||||
args: {
|
args: {
|
||||||
doctype: "Service Factory Settings",
|
doctype: "Service Factory Settings",
|
||||||
name: "Service Factory Settings",
|
name: "Service Factory Settings",
|
||||||
},
|
},
|
||||||
callback: function (resp) {
|
callback: function (r) {
|
||||||
let doc = resp.message;
|
if (!r.message) return;
|
||||||
if (doc.task_types) {
|
let doc = r.message;
|
||||||
let task_options = doc.task_types
|
|
||||||
.map((t) => t.task_type_name)
|
// Set task options
|
||||||
.join("\n");
|
if (doc.task_types && doc.task_types.length) {
|
||||||
frm.set_df_property("task", "options", "\n" + task_options);
|
let opts = "\n" + doc.task_types.map((t) => t.task_type_name).join("\n");
|
||||||
|
frm.set_df_property("task", "options", opts);
|
||||||
frm.refresh_field("task");
|
frm.refresh_field("task");
|
||||||
}
|
}
|
||||||
if (doc.teams) {
|
|
||||||
let team_options = doc.teams
|
// Set team options
|
||||||
.map((t) => t.team_name)
|
if (doc.teams && doc.teams.length) {
|
||||||
.join("\n");
|
let opts = "\n" + doc.teams.map((t) => t.team_name).join("\n");
|
||||||
frm.set_df_property("team", "options", "\n" + team_options);
|
frm.set_df_property("team", "options", opts);
|
||||||
frm.refresh_field("team");
|
frm.refresh_field("team");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Time log rollup
|
// Time log rollup
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue