How to get Company Address in HTML Template?

Hi there,

i’m trying to get company address from html template, any hint?

Thx

Anyone has the same prob?

Do you mean this?


please elaborate.

@Mohammed_Redha Yup …it is changed in version 8 …now the field is address_html and display addresses from Address DocType …it seems kind of complicated to retrieve Company address …

i’ve tried to use:

But getting an error:

("'dict object' has no attribute 'geo'",)

Can someone help on this? It’s really frustrating … :frowning::disappointed_relieved:

Hi @JoEz,

I know this is far from pretty but it worked for me:

{% set links = frappe.get_all('Dynamic Link', filters={'link_doctype': 'Company', 'link_name': doc.company, 'parenttype': 'Address'}, fields=['parent']) %}
{% if links %}
{% set address = frappe.get_doc("Address", links[0].parent) %}
{% endif %} 

Playing with the filters helps if there are multiple addresses. Hope it helps… :wink:

8 Likes

{% set links = frappe.get_all(‘Dynamic Link’, filters={‘link_doctype’: ‘Company’, ‘link_name’: doc.company, ‘parenttype’: ‘Address’}, fields=[‘parent’]) %}
{% if links %}
{{frappe.db.get_value(“Address”, links[0].parent, “address_line1”)}}
{% endif %}

its working

1 Like

{{ doc. address_display or ‘’ }}