Customize Customer Quick Entry
This commit is contained in:
@@ -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");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user