How can I include Invoiced Items on Payment Entry?

Hello all,

I’m trying to include the invoiced items on the payment item. Currently the Payment Entry has the Invoice number but we would like the customer to see all invoiced items.

I’m using version 8. So far:

  1. my scripting efforts have not yielded the desired results.
    Show invoice's item tables in Payment Entry format - #10 by Lewinta

  2. Custom Link field seems to not be working

Please help if there’s a straight forward solution to this. TIA

Would you mind sharing the customisations done.

Hello @ArundhatiS, Thank you for caring to respond. I discarded my previous script and been looking for it. Meantime I’m looking at the closest method I’ve found and will revert soon as I get somewhere:

frappe.ui.form.on("Sales Order", "quotemaster", function(frm) {
frappe.model.with_doc("QuoteMaster", frm.doc.quotemaster, function() {
var qmtable = frappe.model.get_doc("QuoteMaster", frm.doc.quotemaster)
$.each(qmtable.items, function(index, row){
d = frm.add_child("qm_items");
d.item_code = row.item_code;
d.qty = row.qty;

Just dont understand QuoteMaster and quotemaster in this context.


So here I am @ArundhatiS, I’m not sure how I can uniquely connect the invoice to the PE (foreign key).

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

    frappe.model.with_doc("Sales Invoice",, function() {

        var invoice = frappe.model.get_doc("Sales Invoice",

        $.each(invoice.items, function(index, row){
            d = frm.add_child("items");
            d.item_code = row.item_code;
            d.qty = row.qty;

I’m now getting the following error:

Unable to handle success response  desk.min.js:1473:4
console.trace():  desk.min.js:1474<


I think my problem is my trigger.

  • Inability to link the Payment Entry to the related invoice. The invoice number comes through the references table. It would be possible to pick it from there into a trigger field, but It’d still need to relate it to a corresponding field in the invoice, this field is not among the table items of the Invoice DocType. Or is it?

  • Secondly, I just think there must be a better way to this problem. Perhaps an inbuilt method within Frappe. Need someone with more experience to help out.

This solution will go a long way for many users.


  • Turns out the problem really is my trigger. Placing console.log(invoice); above the $each loop shows its null.

check this Post


Thanks @Chibuzor_Derrick this solves the problem

Also thankful to look back at this and see that i can now write with code with zero difficulty that was near impossible to understand then