Hello
I have a “Parcel” Doctype
Wich have a “Parcel Content” Doctype as a child table
If i do frappe.get_doc(‘Parcel’, ‘NAME’)
I get the object with the child table
But i need to print out all the content of multiple “Parcels”
For the moment i have find three ways:
- For each Object, make a query to get “content”:
frappe.get_doc(‘Parcel’, ‘NAME’)
but i need to query this inside a loop, i can do some like 50 queries at a row.
- Query the related content using the parent name:
frappe.get_all(‘Parcel Content’, fields=[‘unit_price’, ‘description’, ‘qty’], filters=[[‘parent’, ‘in’, parcel_names]])
This works quite well, because i have the data
But what about this
- Advanced Join:
Advanced Database queries in Frappe
frappe.get_all(‘Parcel’, fields=“name, carrier,
tabParcel Content
.unit_price”, filters=[[‘name’, ‘in’, parcel_names]])
So i’m able to filter all Objects i Need and join the table to fetch the extra details
My question here:
Is there a best practice or a built-in frappe way to do it?
PS: I’m using this query on a jinja template in a custom print format to render all extra details