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

Hi there,

iam looking for a way to save a default print format for company A and a default print format for compnay B?

Every time when i open up a new quotation the printformat gets lost and its very time consuming to select it for the right company every time by hand. Only the print head with the logo shows correctly. I also tried to save the print format in customize-form, but there is only one to select, so it is used for company A and B for the same time :frowning:

When i use the checkbox standard print format in the corresponding desk#Form/Print Format/ i get the error mesg:
Standard Print Format cannot be updated

how do i make this right?


You would have to write custom script for defaulting print format & you would have to create a new custom print format to change it. You cannot edit standard print format.

thanks @Pawan i hoped this was possible somewhere by default.
yes, the goal is not not edit standard print format, its just to have a default print format for every company. but if this is the way how to do it, i am ready for making this changes because its a time saver.

can anyone, who has done this already, or who wants to do this and has the code knowledge, share this kind of custom script and give me a hint where i have to enter it?

thanks a lot!

1 Like

If you’re concern about the the company address and info only, you might use the Letter Head instead of print format…let me know your plan and I’d see how to help.

I’ve some code over here.

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 = "A" %}
      {% set letter_head = frappe.get_doc("Letter Head", "A") %}
    {% elif = "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 %}

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…


Any update on this topic?

Hi @lasalesi

where will this code be placed?

Hi @olamide_shodunke,

this goes into the Jinja code of your custom print format… Only work if you are using custom print formats though…

Hi @lasalesi do you have any idea if the concern is to set a default print format based on the value of a field. I need to set a completely different print format, not just the header. Since there are different fields that need to be printed.

You can essentially make all content switchable by the company field…

{% if == "A" %}
    <!-- content of type A -->
{% else %}
     <!--- content of type B --->
{% endif %}

You can also mix and match as to have a base template with conditional segments…

1 Like

where i can placed this script