From b11c75c336738bf5b2ee196654012c8eb5e80d85 Mon Sep 17 00:00:00 2001 From: Ty Reynolds Date: Tue, 5 May 2026 08:11:16 -0400 Subject: [PATCH] Added route options to monitor and auto populate fields based off where the quick entry form was spawned from. --- ns_app/public/js/customer_quick_entry.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ns_app/public/js/customer_quick_entry.js b/ns_app/public/js/customer_quick_entry.js index fd0dc24..ef278ee 100644 --- a/ns_app/public/js/customer_quick_entry.js +++ b/ns_app/public/js/customer_quick_entry.js @@ -5,10 +5,11 @@ const _make_quick_entry = frappe.ui.form.make_quick_entry; // Override frappe.ui.form.make_quick_entry = function (doctype, after_insert) { - if (doctype === "Customer") { + if (doctype === "Customer" && frappe.route_options) { console.log("NS App: Intercepted Customer Quick Entry"); ns_app.customer.open_quick_entry({ - callback: after_insert + callback: after_insert, + route_options: frappe.route_options || {} }); return; } @@ -31,7 +32,8 @@ ns_app.customer.open_quick_entry = function (opts = {}) { fieldname: "customer_name", label: "Customer Name", fieldtype: "Data", - reqd: 1 + reqd: 1, + default: opts.route_options?.customer_name || "" }, { fieldname: "customer_type", @@ -129,8 +131,8 @@ ns_app.customer.open_quick_entry = function (opts = {}) { indicator: "green" }); - if (opts.callback) { - opts.callback(r.message); + if (opts.callback && r.message) { + opts.callback(r.message.name || r.message); } }, always() { @@ -209,4 +211,4 @@ ns_app.customer.open_quick_entry = function (opts = {}) { } }); -}; +}; \ No newline at end of file -- 2.39.5