diff --git a/crm/api/doc.py b/crm/api/doc.py index 4f5d71c9..f1fef5cc 100644 --- a/crm/api/doc.py +++ b/crm/api/doc.py @@ -30,6 +30,11 @@ def get_filterable_fields(doctype: str): "Text", ] + c = get_controller(doctype) + restricted_fields = [] + if hasattr(c, "get_non_filterable_fields"): + restricted_fields = c.get_non_filterable_fields() + from_doc_fields = ( frappe.qb.from_(DocField) .select( @@ -42,6 +47,7 @@ def get_filterable_fields(doctype: str): .where(DocField.parent == doctype) .where(DocField.hidden == False) .where(Criterion.any([DocField.fieldtype == i for i in allowed_fieldtypes])) + .where(Criterion.all([DocField.fieldname != i for i in restricted_fields])) .run(as_dict=True) ) res = [] diff --git a/crm/fcrm/doctype/crm_lead/crm_lead.py b/crm/fcrm/doctype/crm_lead/crm_lead.py index 94f9c824..d21fdaa6 100644 --- a/crm/fcrm/doctype/crm_lead/crm_lead.py +++ b/crm/fcrm/doctype/crm_lead/crm_lead.py @@ -196,6 +196,10 @@ class CRMLead(Document): { "label": 'Mobile no', "value": 'mobile_no' }, ] + @staticmethod + def get_non_filterable_fields(): + return ["converted"] + @staticmethod def default_list_data(): columns = [