Merge pull request 'Added route options to monitor and auto populate fields based off where the quick entry form was spawned from.' (#9) from main into production
Reviewed-on: #9
This commit was merged in pull request #9.
This commit is contained in:
@@ -5,10 +5,11 @@ const _make_quick_entry = frappe.ui.form.make_quick_entry;
|
|||||||
|
|
||||||
// Override
|
// Override
|
||||||
frappe.ui.form.make_quick_entry = function (doctype, after_insert) {
|
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");
|
console.log("NS App: Intercepted Customer Quick Entry");
|
||||||
ns_app.customer.open_quick_entry({
|
ns_app.customer.open_quick_entry({
|
||||||
callback: after_insert
|
callback: after_insert,
|
||||||
|
route_options: frappe.route_options || {}
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -31,7 +32,8 @@ ns_app.customer.open_quick_entry = function (opts = {}) {
|
|||||||
fieldname: "customer_name",
|
fieldname: "customer_name",
|
||||||
label: "Customer Name",
|
label: "Customer Name",
|
||||||
fieldtype: "Data",
|
fieldtype: "Data",
|
||||||
reqd: 1
|
reqd: 1,
|
||||||
|
default: opts.route_options?.customer_name || ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldname: "customer_type",
|
fieldname: "customer_type",
|
||||||
@@ -129,8 +131,8 @@ ns_app.customer.open_quick_entry = function (opts = {}) {
|
|||||||
indicator: "green"
|
indicator: "green"
|
||||||
});
|
});
|
||||||
|
|
||||||
if (opts.callback) {
|
if (opts.callback && r.message) {
|
||||||
opts.callback(r.message);
|
opts.callback(r.message.name || r.message);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
always() {
|
always() {
|
||||||
@@ -209,4 +211,4 @@ ns_app.customer.open_quick_entry = function (opts = {}) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user