feat: add filter tables in item group
This commit is contained in:
parent
134f6b1b6c
commit
b06ed4908f
@ -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) {
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user