Set up 2 different default print formats, for 2 different companys?

Hi @philip,

I guess this has been resolved, but just stumbeled upon it :wink: pasting some code for fun…

As long as the company field of the record is set, the template can use a code like this to select the appropriate letter head (assumes companies are called A and B and there are two Letter Heads defined with names A and B respectively):

<div  id="header-html" class="hidden-pdf" >
    {% if doc.company = "A" %}
      {% set letter_head = frappe.get_doc("Letter Head", "A") %}
    {% elif doc.company = "B" %}
      {% set letter_head = frappe.get_doc("Letter Head", "B") %}
    {% endif %}
    {% if letter_head %}
      {{ letter_head.content }}
    {% else %}
      <p>Letter head not found. Please define the letter head under print settings.</p>
    {% endif %}
</div> 

Hopefully this helps somebody.

Maybe someone has a tip for setting the default company in the actual record (Default company should apply for new records (e.g. Sales Invoice, Journal Entry)), which I guess is linked to this…

5 Likes