refactor: Change Filter Fields table fieldtype to `Autocomplete`
- Remove dynamic js fieldtype change to `Select`
diff --git a/erpnext/e_commerce/doctype/e_commerce_settings/e_commerce_settings.js b/erpnext/e_commerce/doctype/e_commerce_settings/e_commerce_settings.js
index a8966b0..69b9cfa 100644
--- a/erpnext/e_commerce/doctype/e_commerce_settings/e_commerce_settings.js
+++ b/erpnext/e_commerce/doctype/e_commerce_settings/e_commerce_settings.js
@@ -27,13 +27,12 @@
frappe.model.with_doctype("Website Item", () => {
const web_item_meta = frappe.get_meta('Website Item');
- const valid_fields = web_item_meta.fields.filter(
- df => ["Link", "Table MultiSelect"].includes(df.fieldtype) && !df.hidden
- ).map(df => ({ label: df.label, value: df.fieldname }));
-
- frm.get_field("filter_fields").grid.update_docfield_property(
- 'fieldname', 'fieldtype', 'Select'
+ const valid_fields = web_item_meta.fields.filter(df =>
+ ["Link", "Table MultiSelect"].includes(df.fieldtype) && !df.hidden
+ ).map(df =>
+ ({ label: df.label, value: df.fieldname })
);
+
frm.get_field("filter_fields").grid.update_docfield_property(
'fieldname', 'options', valid_fields
);
diff --git a/erpnext/portal/doctype/website_filter_field/website_filter_field.json b/erpnext/portal/doctype/website_filter_field/website_filter_field.json
index 67c0d0a..45543a6 100644
--- a/erpnext/portal/doctype/website_filter_field/website_filter_field.json
+++ b/erpnext/portal/doctype/website_filter_field/website_filter_field.json
@@ -1,76 +1,31 @@
{
- "allow_copy": 0,
- "allow_events_in_timeline": 0,
- "allow_guest_to_view": 0,
- "allow_import": 0,
- "allow_rename": 0,
- "beta": 0,
- "creation": "2018-12-31 17:06:08.716134",
- "custom": 0,
- "docstatus": 0,
- "doctype": "DocType",
- "document_type": "",
- "editable_grid": 1,
- "engine": "InnoDB",
+ "actions": [],
+ "creation": "2018-12-31 17:06:08.716134",
+ "doctype": "DocType",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "field_order": [
+ "fieldname"
+ ],
"fields": [
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "fieldname",
- "fieldtype": "Data",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 1,
- "in_standard_filter": 0,
- "label": "Fieldname",
- "length": 0,
- "no_copy": 0,
- "options": "",
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
+ "fieldname": "fieldname",
+ "fieldtype": "Autocomplete",
+ "in_list_view": 1,
+ "label": "Fieldname"
}
- ],
- "has_web_view": 0,
- "hide_heading": 0,
- "hide_toolbar": 0,
- "idx": 0,
- "image_view": 0,
- "in_create": 0,
- "is_submittable": 0,
- "issingle": 0,
- "istable": 1,
- "max_attachments": 0,
- "modified": "2019-01-01 18:26:11.550380",
- "modified_by": "Administrator",
- "module": "Portal",
- "name": "Website Filter Field",
- "name_case": "",
- "owner": "Administrator",
- "permissions": [],
- "quick_entry": 1,
- "read_only": 0,
- "read_only_onload": 0,
- "show_name_in_global_search": 0,
- "sort_field": "modified",
- "sort_order": "DESC",
- "track_changes": 1,
- "track_seen": 0,
- "track_views": 0
+ ],
+ "istable": 1,
+ "links": [],
+ "modified": "2022-04-18 18:55:17.835666",
+ "modified_by": "Administrator",
+ "module": "Portal",
+ "name": "Website Filter Field",
+ "owner": "Administrator",
+ "permissions": [],
+ "quick_entry": 1,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "states": [],
+ "track_changes": 1
}
\ No newline at end of file
diff --git a/erpnext/setup/doctype/item_group/item_group.js b/erpnext/setup/doctype/item_group/item_group.js
index cf96dc1..4b04ac1 100644
--- a/erpnext/setup/doctype/item_group/item_group.js
+++ b/erpnext/setup/doctype/item_group/item_group.js
@@ -75,13 +75,12 @@
frappe.model.with_doctype('Website Item', () => {
const web_item_meta = frappe.get_meta('Website Item');
- const valid_fields = web_item_meta.fields.filter(
- df => ['Link', 'Table MultiSelect'].includes(df.fieldtype) && !df.hidden
- ).map(df => ({ label: df.label, value: df.fieldname }));
-
- frm.get_field("filter_fields").grid.update_docfield_property(
- 'fieldname', 'fieldtype', 'Select'
+ const valid_fields = web_item_meta.fields.filter(df =>
+ ['Link', 'Table MultiSelect'].includes(df.fieldtype) && !df.hidden
+ ).map(df =>
+ ({ label: df.label, value: df.fieldname })
);
+
frm.get_field("filter_fields").grid.update_docfield_property(
'fieldname', 'options', valid_fields
);