Fetch Supplier Invoice Number for multiple Purchase Invoices in Payment Entry

Running v10.1.17 i am able to see Supplier Invoice Number when i make payment from a single purchase invoice. But if I add multiple invoices to the payment entry it does not fetch supplier invoice number. Can anyone show me how to do this? Tried custom script but it does not seem to work.

Custom Script: Payment Entry
cur_frm.add_fetch(“Purchase Invoice”,“bill_no”,“bill_no”);

Custom Form:
Already existing in custom form.

I have the same issue. Did you figure out how to get supplier invoice number on payment entry reference child table from purchase invoice?

I am wanting to pull in bill_no and bill_date from purchase invoice to the payment entry references table which is the child table of payment entry. Is this all I need to do in custom script?
cur_frm.add_fetch(“purchase_invoice”,“bill_no”,“bill_no”)
cur_frm.add_fetch(“purchase_invoice”,“bill_date”,“bill_date”)

I also need to get party bill to address in the payment entry form as we print this on our checks to mail them. I’m clueless on how to get the party address. :persevere:

This worked for me!

Now, how to get the party bill to address on to the payment entry form and I’ll be good to go! :wink:

@charlie-cook
Bill date still not being fetched. Only Bill no. May i ask in what DocType did you place these two lines of script? Can you also attach a screen shot of your result? thanks!

Sure thing… I had a unique need as our checks are three part checks. Top is the actual check, next section is a listing of all invoices paid with this check and the bottom section tears off and we keep it for our records and it is a duplicate of the middle section.

So, I created a custom print format to display the supplier’s invoice number in a table the way I needed it. I gave up on the supplier invoice date. It wasn’t a necessity so I figured I would get that later possibly. For now, we just show the supplier invoice number and that works for us.

I also needed the address printed on the check. Here’s my code that does that. The first line is all I needed to get the supplier invoice number but I did add the field “bill_no” to the Payment Entry References table first.

cur_frm.add_fetch("purchase_invoice", "bill_no", "bill_no");
// frappe.ui.form.on("Payment Entry", {
// 	address: function(frm) {
// 		erpnext.utils.get_address_display(this.frm, "address", "address_display");
// 	}
// });

frappe.ui.form.on("Payment Entry", "party", function(frm) {

// erpnext.utils.render_address_and_contact(frm);
// $(frm.fields_dict['address_html'].wrapper)
// 			.html(frappe.render_template("address_list",
// 				cur_frm.doc.__onload))
// 			.find(".btn-address").on("click", function() {
// 				frappe.new_doc("Address");
// 			});

// var details = erpnext.accounts.party.get_party_details;
// console.log(details);

/*

get_party_details(party=None, account=None, party_type="Customer", company=None,
	posting_date=None, price_list=None, currency=None, doctype=None, ignore_permissions=False)

*/

frappe.call({
    method: "erpnext.accounts.party.get_party_details", //dotted path to server method,
    args:{'party':frm.doc.party,'party_type':frm.doc.party_type},
    callback: function(r) {
        // code snippet
        if(r)
        {
	cur_frm.set_value("address_display", r.message.address_display);
        console.log(r);
    	}
    }
})

});
1 Like