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
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
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?
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 guess this has been resolved, but just stumbeled upon it 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>
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.