Apply Filters In Quick Entry

Include this line hooks:
app_include_js = ["/assets/custom_app/js/lead_quick_entry.js"]

Add below code in your custom quick_entry.js

frappe.old_doc = frappe.new_doc

frappe.new_doc = function(doctype, opts, init_callback) {

if(doctype == "Lead"){

    frappe.old_doc("Lead", opts, function(dialog) {

        dialog.get_field("cost_center").get_query = function(doc) {

            return {

                filters: {

                    is_group: 0

                }

            }

        }

    })

}else {

    frappe.old_doc(doctype, opts, function(dialog) {})

}

}

1 Like