Header customization

Deal All,

please be so kind if there is any way to include the logo of the company and doc type series at the same header format due to if we use letter head for one side and print head for another side the result is as follows , placing in different lines:

Waiting your help.

Regards

Hello sgomez,

try the following in HTML mode.

<div class="row">
    <div class="col-xs-6">The Code for your logo</div>
    <div class="col-xs-6">SALES INVOICE<br />{{ doc.name }}</div>
</div>

Dear ci2016,

Thank you for your information.

I will try but we need for all doc-types so writing sales invoice I assume that it is only valid por this doc type no?

I mean we need all the documents ( PO, quaotion, invoice, etc etc) with this configuration.

REgards.

Dear sgomez,

I just realized that the letter head doesn’t support Jinja Templating, so that means, that {{ doc.name }} as well as other solutions for SALES INVOICE won’t work by now.

For now, heres the feature request on GitHub.

EDIT: I created a pull request, to add this functionality. I hope they can merge it like it is to the core.

Until that moment, you can try to do the following:

  1. Edit the file frappe-bench/apps/frappe/frappe/www/printview.py

  2. Replace the lines “letter_head” and “footer” in the dictionary with the following:

     "letter_head": frappe.utils.jinja.render_template(letter_head.content, {"doc": vars(doc)}),
     "footer": frappe.utils.jinja.render_template(letter_head.footer, {"doc": vars(doc)}),
    
  3. The dictionary should look as follows:

     args = {
     	"doc": doc,
     	"meta": frappe.get_meta(doc.doctype),
     	"layout": make_layout(doc, meta, format_data),
     	"no_letterhead": no_letterhead,
     	"trigger_print": cint(trigger_print),
     	"letter_head": frappe.utils.jinja.render_template(letter_head.content, {"doc": vars(doc)}),
     	"footer": frappe.utils.jinja.render_template(letter_head.footer, {"doc": vars(doc)}),
     	"print_settings": frappe.get_doc("Print Settings")
     }
    
  4. Save the file and on production run bench restart from the frappe-bench folder.

  5. It should work now.

1 Like