ERPNext, How to include Company details to Letter Head?

This is the HTML code, how can I set the company name and address inside the letter head HTML. Is it get the value from doctype?

@anon67314007 You have to create logo with company details or you can add static company details using html

Hi @anon67314007,

If you want to add the address with dynamically way then please check it.

{% set links = frappe.get_all('Dynamic Link', filters={'link_doctype': 'Company', 'link_name': doc.company, 'parenttype': 'Address'}, fields=['parent']) %}
{% if links %}
    {% set address = frappe.db.get_value('Address', links[0].parent, ['address_line1', 'address_line2', 'city', 'state', 'pincode', 'country', 'email_id', 'phone'], as_dict=True) %}
    {{ address.address_line1 }}<br>
    {% if address.address_line2 %}{{ address.address_line2 }}<br>{% endif %}
    {{ address.city }}<br>
    {{ address.state }} - {{ address.pincode }}<br>
    {{ address.country }}<br>
    {% if address.email_id %}Email: {{ address.email_id }}<br>{% endif %}
    {% if address.phone %}Phone: {{ address.phone }}{% endif %}
{% endif %}


I hope this helps!
2 Likes

Where we have to place this code?
I was trying to use custom script but not working

@anon67314007 if you have fix this issue, please let me know how you did it>

Place that code in print format in which you want.

I want to use it inside the letter head, so that it can affect in reports and invoices when selecting the letterhead>

The letterhead does not accept this syntax {{ address.phone }}

You can create a banner image for the company details like logo name adress contact and use as letter head

I don’t want static details like image, or pure HTML, I want it to be dynamically fetched based on the company details

it is dynamic for each company set multiple banners so when user select the company they can also select the banner for letterhead

then you can fetch the company details in that document and fetch company details in other fields and hide those field then fetch in print format when you change the company it will automatically change in the format