diff --git a/crm/api/doc.py b/crm/api/doc.py index 9f7353ea..b7b02511 100644 --- a/crm/api/doc.py +++ b/crm/api/doc.py @@ -130,7 +130,7 @@ def get_fields_meta(DocField, doctype, allowed_fieldtypes, restricted_fields): def get_quick_filters(doctype: str): meta = frappe.get_meta(doctype) fields = [field for field in meta.fields if field.in_standard_filter] - quick_filters = [{"label": _("ID"), "name": "name", "type": "Link", "options": doctype}] + quick_filters = [] for field in fields: diff --git a/frontend/src/components/ViewControls.vue b/frontend/src/components/ViewControls.vue index 72d899f7..432bfc9e 100644 --- a/frontend/src/components/ViewControls.vue +++ b/frontend/src/components/ViewControls.vue @@ -34,11 +34,9 @@ " >
{ return _views }) +const quickFilterList = computed(() => { + let filters = [{ name: 'name', label: __('ID') }] + if (quickFilters.data) { + filters.push(...quickFilters.data) + } + + filters.forEach((filter) => { + filter['value'] = '' + if (list.value.params?.filters[filter.name]) { + if (['Check', 'Select'].includes(filter.type)) { + filter['value'] = list.value.params.filters[filter.name] + } else { + let value = list.value.params.filters[filter.name] + filter['value'] = value[1].replace(/%/g, '') + } + } + }) + + return filters +}) + const quickFilters = createResource({ url: 'crm.api.doc.get_quick_filters', params: { doctype: props.doctype }, + cache: ['Quick Filters', props.doctype], auto: true, })