Billing Address is not showing in Purchase Order

Hello,

I’m newbie in ERPNext.
I have created custom field for billing address in Purchase Order report and wrote following code for popping up billing address in billing address display field. I’m able to select billing address from list but it’s not showing in billing address box as shown in screenshot.
Could you please give me solution for this.
Quick response will be highly appreciable.
image

Thanks.

did u tried with fecth function?

Try below code, change accordingly

frappe.ui.form.on(“Purchase Order”, “address_title”, function(frm, cdt, cdn) {
return frm.call({
method: “frappe.contacts.doctype.address.address.get_address_display”,
args: {
“address_dict”: frm.doc.address_title
},
callback: function(r) {
if(r.message)
frm.set_value(“detail_address”, r.message);
}
});
});