What’s the most efficient way to grab a short address in v13? There appear to have been different methods in the past and its not clear what the best method is currently. I did create a script that successfully updates a “Remittance Address” field in Sales Invoice with fields from Address. I see that the built-in addresses use combination of a link to Address and a small text display field (for printing purposes).
The custom script must be necessary to populate the display field but how to grab the shortened version? I think that Address Template is involved but not sure how I’d incorporate that.
Here’s my script for reference:
cur_frm.cscript.custom_onload = function () {
if (cur_frm.doc.remittance_address_name) {
frappe.call({
"method": "frappe.client.get",
args: {
doctype: "Address",
name: cur_frm.doc.remittance_address_name
},
callback: function (data) {
frappe.model.set_value(cur_frm.doctype,cur_frm.docname, "remittance_address_display",
data.message.address)
}
})
}
}