How to get the Advance Payment Posting date in Sales invoice Print format


The posting date is only available in the payment entry doctype… and the Sales Invoice Advance doesn’t have the posting_date either

How do we reference it in the Sales invoice using the frappe.db.get_value(“[doctype]”, “[name]”, “fieldname”)

After lots of trial and error

the below works.

{% set a = doc.get("advances")[0].reference_name %}
{% set b = frappe.db.get_value("Payment Entry", {"name": a }, "posting_date") %}
{{ frappe.format( b ) }}

This is gives the formatted Posting date of the payment entry for the particular Sales invoice.

Hope this helps