Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

2

How to have custom header in qweb report?

By
Yogesh
on 11/24/14, 9:40 AM 6,475 views

I need to have headers report specific, I know I can inherit standard header and customize that but it becomes global header, If I inherit header in both reports it prints in one only which loads later ( later report replaces previous header). how can I have report spcific headers?

2
Sajin Aziz
On 11/25/14, 12:37 PM

  <div class="header">
            This Is Header
  </div>

use it before <div class="page">  in report,

to re-use make it as seperate template. then u can use <t t-call="module_name.template_id"/>

Thanks @ Sajin Aziz

Ankit H Gandhi(AHG)
on 2/4/15, 3:50 AM
2

Yenthe

--Yenthe--
6676
| 7 7 8
Turnhout, Belgium
--Yenthe--

My Odoo blog: http://www.odoo.yenthevg.com/

My Twitter: https://twitter.com/Yenthe666

Yenthe
On 2/4/15, 2:19 AM

Hi Yogesh!

You actually have two options. The first is to create a new header template in the module reports, in the file layouts.xml (addons/report/views/layouts.xml). For example:

<template id="your_custom_layout_header">

<div class="header">

<div class="row">

<div class="col-xs-3">

<img t-if="company.logo" t-att-src="'data:image/png;base64,%s' % company.logo" style="max-height: 45px;"/>
<!-- All your custom code here -->

</div>
</div>
</div>

</template>

Which you can then load in your report.

<t t-call="report.your_custom_layout_header">

The second option is to use the header element in Odoo. Before the <div class="page"> tag you can then do this:

<div class="header">
           <h3>Header title</h3>
          <t t-esc="o.name"/>
  </div>

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

Asked: 11/24/14, 9:40 AM
Seen: 6475 times
Last updated: 9/3/15, 3:15 PM