diff --git a/erpnext/setup/doctype/item_group/item_group.js b/erpnext/setup/doctype/item_group/item_group.js index 9892dc3dcc..1413cb2862 100644 --- a/erpnext/setup/doctype/item_group/item_group.js +++ b/erpnext/setup/doctype/item_group/item_group.js @@ -61,6 +61,19 @@ frappe.ui.form.on("Item Group", { frappe.set_route("List", "Item", {"item_group": frm.doc.name}); }); } + + frappe.model.with_doctype('Item', () => { + const item_meta = frappe.get_meta('Item'); + + const valid_fields = item_meta.fields.filter( + df => ['Link', 'Table MultiSelect'].includes(df.fieldtype) && !df.hidden + ).map(df => ({ label: df.label, value: df.fieldname })); + + const field = frappe.meta.get_docfield("Website Filter Field", "fieldname", frm.docname); + field.fieldtype = 'Select'; + field.options = valid_fields; + frm.fields_dict.filter_fields.grid.refresh(); + }); }, set_root_readonly: function(frm) { diff --git a/erpnext/setup/doctype/item_group/item_group.json b/erpnext/setup/doctype/item_group/item_group.json index 004421d2bc..119d54196d 100644 --- a/erpnext/setup/doctype/item_group/item_group.json +++ b/erpnext/setup/doctype/item_group/item_group.json @@ -26,6 +26,9 @@ "slideshow", "description", "website_specifications", + "website_filters_section", + "filter_fields", + "filter_attributes", "lft", "rgt", "old_parent" @@ -180,6 +183,23 @@ "options": "Item Group", "print_hide": 1, "report_hide": 1 + }, + { + "fieldname": "website_filters_section", + "fieldtype": "Section Break", + "label": "Website Filters" + }, + { + "fieldname": "filter_fields", + "fieldtype": "Table", + "label": "Item Fields", + "options": "Website Filter Field" + }, + { + "fieldname": "filter_attributes", + "fieldtype": "Table", + "label": "Attributes", + "options": "Website Attribute" } ], "icon": "fa fa-sitemap", @@ -188,7 +208,7 @@ "is_tree": 1, "links": [], "max_attachments": 3, - "modified": "2020-03-18 18:10:34.383363", + "modified": "2020-12-29 14:04:26.075008", "modified_by": "Administrator", "module": "Setup", "name": "Item Group",