我有一个"Parcel“Doctype,它有一个”Parcel“Doctype作为子表。
如果我这样做了:
frappe.get_doc('Parcel', 'NAME')我得到包含子表的对象,它对单个对象起作用。
,但是我需要获得多个对象和他的子表字段。
所以我不能呈现一个定制的jinja模板。
例:
frappe.get_all('Parcel', fields=['fields_of_parent', 'content'], filters=[])这样我就可以得到过滤过的对象和子表。
发布于 2020-07-06 04:37:49
您必须查询子表:
frappe.get_all("Parcel Content",
filters = dict(parent=parcel_name),
fields = [fields of child table])`发布于 2022-08-02 16:15:59
使用列表理解:
[frappe.get_doc("Parcel", item.name).as_dict() for item in frappe.get_all("Parcel")]
这将返回所有doctype及其各自的子表项。甚至不需要基于子表名进行查询。
https://stackoverflow.com/questions/62736177
复制相似问题