Fetch customer address into payment request

Hello everyone

I am trying to fetch info from Sales invoice to Payment request in order to create a printable payment request to send to our customers.

#What I want to do:
→ fetch customers address (address_display)which is selected on invoice. Display that address on the payment request form.

#What I did:

  • added field to payment request doctype name: address_display type read only.
  • added a custom script on payment request:
    frappe.ui.form.on(‘Payment Request’, {
    refresh(frm) {
    cur_frm.add_fetch(‘reference_name’, ‘address_display’, ‘address_display’);
    }
    })

What am I missing?

Thank you so much for any inputs!

luju

If only the printed Payment Request matters, I would suggest creating a custom Print Format, instead of modifying the Payment Request classes.

You can combine Payment Request fields + Sales Invoice fields in your custom Print Format, and build whatever printed design you need.

Thank you so much for the feedback. How can I get fields from parent doctype in the payment request printformat?

{{ doc.address_display }} ← Can I add there that the field comes from invoice doctype?