fix: Consider Table Multiselect fields in Query engine
- Since table multiselect fields were not handled, the query tried searching for this child field in item master
- This broke the query
- On trying to reload or go back to all-products page with field filters that are table mutiselect, page breaks
diff --git a/erpnext/shopping_cart/product_query.py b/erpnext/shopping_cart/product_query.py
index 0b05f68..cd4a176 100644
--- a/erpnext/shopping_cart/product_query.py
+++ b/erpnext/shopping_cart/product_query.py
@@ -115,6 +115,17 @@
if not values:
continue
+ # handle multiselect fields in filter addition
+ meta = frappe.get_meta('Item', cached=True)
+ df = meta.get_field(field)
+ if df.fieldtype == 'Table MultiSelect':
+ child_doctype = df.options
+ child_meta = frappe.get_meta(child_doctype, cached=True)
+ fields = child_meta.get("fields", { "fieldtype": "Link", "in_list_view": 1 })
+ if fields:
+ self.filters.append([child_doctype, fields[0].fieldname, 'IN', values])
+ continue
+
if isinstance(values, list):
# If value is a list use `IN` query
self.filters.append([field, 'IN', values])