Fetch supplier invoice no in Payment entry print format

What would be the most efficient way of fetching the supplier invoice number to make it appear on a Payment entry print format?

Thank you

Ok, got it to work with this custom script:

frappe.ui.form.on(“Payment Entry Reference”, “reference_name”,
function(frm, cdt, cdn) {
“method”: “frappe.client.get_value”,
args: {
doctype: “Purchase Invoice”,
fieldname: [“bill_no”],
filters: {name: locals[cdt][cdn].reference_name}
callback: function (data) {
frappe.model.set_value(cdt, cdn, field, data.message[field]);

But this only works when manually creating a payment entry. If payment entry is built by the “make” button from a purchase invoice, script does not execute.

Thank you

1 Like