From e850928e57c5a7f87568eb2f6c53433602ef73ef Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Sun, 31 Dec 2023 14:35:37 +0530 Subject: [PATCH] fix: allow setting non filterable fields --- crm/api/doc.py | 6 ++++++ crm/fcrm/doctype/crm_lead/crm_lead.py | 4 ++++ 2 files changed, 10 insertions(+) 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 = [