I created a custom Print Format for Purchase Receipt which linked to a Material Request. However, I could not fetch the Material Request name into Purchase Receipt Print Format. They are internal linked and I could not find a way to find the linked field. I tried this {{ frappe.get_doc(‘Material Request’, doc.purchase_receipt).name }} but it seems to fetch the first found Material Request document which is not the one that linked to desired Purchase Receipt.
So it seems like it belongs to a child table in Purchase Receipt, I tried these but did not work:
{% for row in doc.purchase_receipt_details %}{{ row.material_request }} {% endfor %}
{% for row in doc.purchase_receipt_item %}{{ row.material_request }} {% endfor %}