Try ERPNext Try Frappe Cloud Buy Support Partners Foundation

How to get Link(ed) document with frappe.get_list?

I have a doctype with a Link field. For example, how the customer is linked to a Quotation in ERPNext.

With frappe.get_all, I can specify fields to get in the ‘list of dicts’ in my templates. This is fine. But now, Should I make an extra db call to fetch details about the Link(ed) document?

Is there a way to get the linked document in the initial get_all call, as another dict?

For those familiar with Django ORM. This can be likened to how I can make the following query:  # Getting linked Doc's fields

AFAIK you need frappe.get_doc

I have used this before. But if I’m looping a lot of records, won’t it make a lot of db queries?

I think it would be the same. I mean the linked document is a record in a different DB table so even get_list would have to make a DB call on that table to fetch you the linked document fields.

You don’t necessarily need to write a script for this. This can easily be fixed by adding a fetch from property in the doctype settings? Elaborate your use case.

I have given an example of what I want to achieve