Customize Customer Quick Entry

This commit is contained in:
Ty Reynolds
2026-01-12 09:19:45 -05:00
parent 61bd56e6da
commit 1853ec0dc3

View File

@@ -1 +1,44 @@
console.log("NS App loaded");
frappe.ready(() => {
const original_make_quick_entry = frappe.ui.form.make_quick_entry;
frappe.ui.form.make_quick_entry = function (doctype, after_insert, init_callback) {
if (doctype !== "Customer") {
return original_make_quick_entry.apply(this, arguments);
}
console.log("NS App: Custom Customer Quick Entry Loaded");
return original_make_quick_entry.call(
this,
doctype,
after_insert,
function (doc) {
// Defaults
doc.customer_group = "Commercial";
doc.territory = "United States";
if (init_callback) {
init_callback(doc);
}
}
);
};
});
frappe.ui.form.on("Customer", {
onload(frm) {
if (!frm.is_quick_entry) return;
console.log("NS App: Modifying Quick Entry Fields");
// Remove unwanted fields
frm.toggle_display("customer_group", false);
// Make fields required
frm.set_df_property("mobile_no", "reqd", 1);
// Set default values
frm.set_value("territory", "United States");
}
});