How to fetch address information


I am using ERPNext 8 and have manged to get the display address using method: “frappe.geo.doctype.address.address.get_address_display”, but I am wanting to access the individual parts of the address which are not displayed like email, fax and phone. How can I do this?

Using frm.add_fetch isn’t working (Invalid field name when trying “address_line_1” etc) or if no error, it doesn’t update the data field on the form (but I suspect more likely the routine is failing silently)

I think the biggest issue I am having is the lack of clear documentation with the change to 8. If anyone can point me to an up to date documentation source I would be very grateful. Most of what I am getting from search is not relevant or out of date.

Thanks in advance.

I found the issue… A typo on my end but I noticed the way to get add_fetch working correctly is to use cur_frm.add_fetch outside of the function, and not in the function as this only works on the second selection of a link field.

If you want to use cur_frm.add_fetch function inside the class, then you have to put it inside setup method.

Can class be used in custom script? And if so how?

| |


You can write like this:

frappe.ui.form.on('Sales Invoice', {
	setup: function(frm) {

Thanks I’ll put that in right away.
Where can I find the latest docs which outline the above?

1 Like