Added route options to monitor and auto populate fields based off where the quick entry form was spawned from.
This commit is contained in:
@@ -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 = {}) {
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user