如何在列表视图中为子项指定过滤器?

问题描述

我想通过以下方式打开销售订单列表并指定过滤器

frappe.set_route('List','Sales Order','List',{'items': {'item_code':my_specific_item_code}})

但它不会以这种方式工作 - 没有应用于列表的过滤器。如何在 frappe.set_route 函数中为子表项指定过滤器?

解决方法

如果有人也有类似的问题,我已经找到了解决方案。 frappe.set_route 对象参数转换为函数 frappe/public/js/frappe/list/list_view.jsListView::parse_filters_from_route_options 中描述的过滤器的逻辑。对于我的特殊情况,应该这样写:

frappe.set_route('List','Sales Order','List',{'<Child Table Doctype(Sales Order Item)>.item_code':my_specific_item_code});