From e84b04ddd8c08547f4987c006ae1cd9de5e338c8 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 16 Jul 2026 14:43:30 +0000 Subject: [PATCH] chore: fix Select dropdown options loading from Settings --- AGENTS.md | 2 +- .../engagement_card/engagement_card.js | 49 +++++++------------ 2 files changed, 19 insertions(+), 32 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 256fc0d..30bda6d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,6 +1,6 @@ # 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 diff --git a/service_factory/service_factory/service_factory/doctype/engagement_card/engagement_card.js b/service_factory/service_factory/service_factory/doctype/engagement_card/engagement_card.js index ab7c481..53171ed 100644 --- a/service_factory/service_factory/service_factory/doctype/engagement_card/engagement_card.js +++ b/service_factory/service_factory/service_factory/doctype/engagement_card/engagement_card.js @@ -3,9 +3,7 @@ frappe.ui.form.on("Engagement Card", { refresh: function (frm) { - // Load dynamic options from Settings - load_options(frm); - + load_select_options(frm); // Quick status actions if (frm.doc.status === "Discovery") { frm.add_custom_button(__("Move to Delivery"), function () { @@ -66,41 +64,30 @@ frappe.ui.form.on("Engagement Card", { }, }); -function load_options(frm) { - // Fetch task options from Settings +function load_select_options(frm) { frappe.call({ - method: "frappe.client.get_single_value", + method: "frappe.client.get", args: { doctype: "Service Factory Settings", + name: "Service Factory Settings", }, callback: function (r) { if (!r.message) return; + let doc = r.message; - // Get task types - need full doc for table fields - frappe.call({ - method: "frappe.client.get", - args: { - doctype: "Service Factory Settings", - name: "Service Factory Settings", - }, - callback: function (resp) { - let doc = resp.message; - if (doc.task_types) { - let task_options = doc.task_types - .map((t) => t.task_type_name) - .join("\n"); - frm.set_df_property("task", "options", "\n" + task_options); - frm.refresh_field("task"); - } - if (doc.teams) { - let team_options = doc.teams - .map((t) => t.team_name) - .join("\n"); - frm.set_df_property("team", "options", "\n" + team_options); - frm.refresh_field("team"); - } - }, - }); + // Set task options + if (doc.task_types && doc.task_types.length) { + 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"); + } + + // Set team options + if (doc.teams && doc.teams.length) { + let opts = "\n" + doc.teams.map((t) => t.team_name).join("\n"); + frm.set_df_property("team", "options", opts); + frm.refresh_field("team"); + } }, }); }