Odoo Help

2

2
2 Answers
4
Avatar

Sajin Aziz United Arab Emirates

--Sajin Aziz--

808
| 2 2 5
Dubai, United Arab Emirates
--Sajin Aziz--
Sajin Aziz United Arab Emirates
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"/>

1 Comment
Ankit H Gandhi(AHG) India
2/4/15, 3:50 AM

Thanks @ Sajin Aziz

5
Avatar

Yenthe Van Ginneken Belgium

--Yenthe Van Ginneken--
25148
| 9 9 12
Turnhout, Belgium
--Yenthe Van Ginneken--


Yenthe Van Ginneken Belgium
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>

2 Comments
Donald Leaman United States
1/13/19, 10:22 PM

I did it like your second example. But it does not have a separator line under it. I tried <hr> and it wanted </hr> as well. Then I added style of height. It didn't work. How do I get a bold horizontal line at the end of the header?

Donald Leaman United States
1/14/19, 11:19 AM

On the other hand, looking at your first example, I went to /usr/lib/python2.7/dist-packages/odoo/addons/report/views/layout_templates.xml and fount the templates for the odoo-supplied header and footer and used them as examples for my various customized headers and footers for my own various customized reports. Works great!

Ask a Question
Writer
Keep Informed
1 follower(s)
About This Community

This platform 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.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now