Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
4 Antwoorden
20001 Weergaven

Hello everyone,

In odoo 11 I''d like to use a custom header for each document 

<template id="templ_id">
<t t-call="web.html_container">
<t t-call="web.external_layout">
<t t-set="o" t-value="o.with_context({'lang':o.partner_id.lang})"/>
<div class="page">

<div class="header">
my header
</div>
.......................

This code gets the default odoo header.

What shuld I do to get my own header?

Thanks

Avatar
Annuleer
Beste antwoord

Hi,

Don't use web.external_layout and replace it with <t t-call="web.internal_layout">. after that follow bellow steps and comment out the default internal layout details.

Settings -> Technical -> Views -> Go to the internal_layout

and comment bellow code segment.


Then you can define your custom header on your header tag.


Cheers!  

Avatar
Annuleer
Auteur

But this solution it will apply also for other documents that call internal layout.

For each document I should define a header.

Thanks

Beste antwoord

Hello bjr Please try below code I'm 100% sure this code is working for you.
You can create your custom Header and Footer as par your requirement but don't forget to use this way.

First custom header template :- 

<template id="custom_my_layout_footer">

            <div class="footer">

                <div class="text-center">

                    <ul class="list-inline">

                        <li class="col-xs-2" style="background-color:rgba(31, 32, 65, 1);color:#fff;">Printed By:-</li>

                        <li class="col-xs-7" style="text-align:center;background-color:rgba(31, 32, 65, 1);color:#fff;">

                            Page: <span class="page"/> / <span class="topage"/>

                        </li>

                        <li class="col-xs-3" style="background-color:rgba(31, 32, 65, 1);color:#fff;">

                            <span t-esc="context_timestamp(datetime.datetime.now()).strftime('%Y-%m-%d %H:%M:%S')"/>

                        </li>

                    </ul>

                </div>

            </div>

        </template>

Custom footer template:-

<template id="partner_external_footer">

            <div class="footer">

                <div class="footer">

                    <strong>

                        This is computer generated invoice no signature required.

                    </strong>

                </div>

            </div>

        </template>


Second create main external template and call above temple into this template :- 

<template id="jt_report_external_layout">

            <t t-if="o and 'company_id' in o">

                <t t-set="company" t-value="o.company_id"/>

            </t>

            <t t-if="not o or not 'company_id' in o">

                <t t-set="company" t-value="res_company"/>

            </t>

            <div class="article">

                <t t-call="jt_my_invoice_report.custom_layout_header_my"/>

                <t t-raw="0"/>

                <t t-call="jt_my_invoice_report.custom_my_layout_footer"/>

            </div>

        </template>

Last point :-    Use this jt_report_external_layout template into your main report template after the <t t-call="web.html_container"> of any report template.    


 <template id="jt_my_account_report_invoice_document1">

            <t t-call="web.html_container">

                <t t-call="jt_my_invoice_report.jt_report_external_layout">


Avatar
Annuleer
Beste antwoord

Try this one:

    <template id="report_student_on_probation">
          <t t-call="report.layout">
            <div class="page">
                <div class="text-center">
                    <h4><b>Hello This is Custom Report (Odoo QWEB)</b></h4>
                </div>
           </div>
           </t>
 </template>


Avatar
Annuleer