fix: allow setting non filterable fields

This commit is contained in:
Shariq Ansari 2023-12-31 14:35:37 +05:30
parent 4aa0c1402f
commit e850928e57
2 changed files with 10 additions and 0 deletions

View File

@ -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 = []

View File

@ -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 = [