Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

create a div that can be repeated on every page of the report on odoo 11 Entreprise

Subscribe

Get notified when there's activity on this post

This question has been flagged
2 Replies
10997 Views
Avatar
Ben

Hi, I would like to know when we create a custom report is it possible to create a block (div) that can be repeated on all pages of the report without it being in the header or in the footer?

If yes; how to do it ?

I work on odoo 11 Enterprise version

0
Avatar
Discard
Jenish M

Hello Ben,
Did you find a way to repeat the div.

Avatar
Ben
Author Best Answer

In red my header and in blue the content of the page so my header overlaps with the content of the page and even I try to change the height of the header it does not work.

Here is my code, if it can help

<odoo>

<report
    id="account_invoices"
    model="sale.order"
    string="Pro-forma"
    report_type="qweb-pdf"
    name="sale_discount.report_saleorder_pro_forma_t"
    file="sale_discount.report_saleorder_pro_forma_t"
    attachment_use="True"
    attachment="(object.state in ('open','paid')) and
        ('INV'+(object.number or '').replace('/','')+'.pdf')"
/>


<template id="report_invoicess">
    <t t-call="web.html_container">
        <t t-foreach="docs" t-as="o">
            <t t-call="sale_discount.internal_layout_test">
                <div class="header" style="border:1px solid #1d0296;">
                    <div bottom="100px;">
                        <div class="col-xs-12" style="border:1px solid #cccccc;">
                            <div class="col-xs-6"  style="padding:20px">
                            <h2>
                                <t t-if="not (env.context.get('proforma', False) or is_pro_forma)">
                                    <span t-if="doc.state not in ['draft','sent']">Order # </span>
                                    <span t-if="doc.state in ['draft','sent']">Quotation # </span>
                                </t>
                                <t t-if="env.context.get('proforma', False) or is_pro_forma">
                                    <span>Proforma N°.- </span>
                                </t>
                                <span t-field="doc.name"/>
                            </h2>
                            </div>
                            <div class="col-xs-5 col-xs-offset-1"  style="padding:20px">
                                <p><strong>Détails du client</strong></p>
                                <div t-field="doc.partner_id"
                                    t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' />
                                <p t-if="doc.partner_id.vat"><t t-esc="doc.company_id.country_id.vat_label or 'TIN'"/>: <span t-field="doc.partner_id.vat"/></p>
                            </div>
                        </div>

                        <div class="col-xs-12" style="border:1px solid #000000; padding:20px">
                            <div t-if="doc.client_order_ref" class="col-xs-3">
                                <strong>Reference Client:</strong>
                                <p t-field="doc.client_order_ref"/>
                            </div>
                            <div t-if="doc.confirmation_date and doc.state not in ['draft','sent']" class="col-xs-3">
                                <strong>Date de Confirmation:</strong>
                                <p t-field="doc.confirmation_date" t-field-options='{"format": "d/M/y"}'/>
                            </div>
                            <div t-if="doc.date_order and doc.state in ['draft','sent']" class="col-xs-3">
                                <strong>Date de la Proforma:</strong>
                                <p t-field="doc.date_order" t-field-options='{"format": "d/M/y"}'/>
                            </div>
                            <div t-if="doc.user_id.name" class="col-xs-3">
                                <strong>Vendeur:</strong>
                                <p t-field="doc.user_id"/>
                            </div>
                            <div t-if="doc.user_id.name" class="col-xs-3">
                                <strong>Contact N°:</strong>
                                <p t-field="doc.user_id.phone"/>
                            </div>
                            <div t-if="doc.user_id.name" class="col-xs-3">
                                <strong>Email:</strong>
                                <p t-field="doc.user_id.login"/>
                            </div>
                        </div>
                        <div class="col-xs-12" style="border:1px solid #000000; height:25px;">
                    </div>
                </div>
                </div>
                
                 <div class="page" >
            <!--div class="oe_structure"/-->
        
            <!-- Is there a discount on at least one line? -->
            <t t-set="display_discount" t-value="any([l.discount for l in doc.order_line])"/>


            <t t-foreach="doc.order_lines_layouted()" t-as="page">
                <!--table class="table table-condensed" style="border:1px solid #cccccc;" border="1"-->
                <div width="100%"  heigth="auto" style="border:0px solid #000000;">
                <table class="table table-condensed" >
                    <thead >
                        <tr>
                            <th class="text-center" style="border-right:1px solid #000000">Description</th>
                            <th class="text-center" style="border-right:1px solid #000000">Quantité</th>
                            <th class="text-center" style="border-right:1px solid #000000">Prix Unitaire</th>
                            <th t-if="display_discount" class="text-center" groups="sale.group_discount_per_so_line" style="border-right:1px solid #000000">REMISE.(%)</th>
                            <th class="text-center" style="border-right:1px solid #000000">T.V.A</th>
                            <th class="text-center" groups="sale.group_show_price_subtotal">COUT H.T.</th>
                            <!--th class="text-center">COUT T.T.C</th-->
                        </tr>
                   </thead>
                   <tbody class="sale_tbody">
                        <t t-foreach="page" t-as="layout_category">

                            <t t-if="layout_category_size > 1 or page_size > 1" groups="sale.group_sale_layout">
                                <tr class="active">
                                    <td colspan="7" style="font-weight: bold; border-bottom: 0px solid black;">&amp;bull;
                                        <t t-esc="layout_category['name']"/>
                                    </td>
                                </tr>
                            </t>

                            <!--t t-set="i" t-value="1"/>
                                <tr t-foreach="o.order_line" t-as="l">
                                     <Check Condition and break>
                                    <td> <span t-esc="i"/></td>
                                    <t t-set="i" t-value="i+1"/>
                                </tr>
                            </t-->

                            <!-- Lines associated -->
                            <t t-foreach="layout_category['lines']" t-as="l">
                                <tr>
                                    <td><span t-field="l.name"/></td>
                                    <td class="text-right">
                                        <span t-field="l.product_uom_qty"/>
                                        <span t-field="l.product_uom" groups="product.group_uom"/>
                                    </td>
                                    <td class="text-right">
                                        <span t-field="l.price_unit"/>
                                    </td>
                                    <td t-if="display_discount" class="text-right" groups="sale.group_discount_per_so_line">
                                        <span t-field="l.discount"/>
                                    </td>
                                    <td class="text-right">
                                        <span t-esc="', '.join(map(lambda x: (x.description or x.name), l.tax_id))"/>
                                    </td>
                                    <td class="text-right" groups="sale.group_show_price_subtotal" style="background-color: transparent !important;">
                                        <span t-field="l.price_subtotal"
                                            t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/>
                                    </td>
                                    <!--td class="text-right" style="background-color: transparent !important;">
                                        <span t-field="l.price_total"
                                            t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/>
                                    </td-->
                                </tr>
                            </t>
                            <!--t t-if="page_index &lt; page_size - 1" groups="sale.group_sale_layout">
                    <p style="page-break-before:always;"> </p>
                            </t-->

                            <t t-if="(layout_category_size > 1 or page_size > 1) and layout_category['subtotal']" groups="sale.group_sale_layout">
                                <tr class="text-right">
                                    <td colspan="6">
                                        <strong>Subtotal: </strong>
                                        <t t-set="subtotal" t-value="sum(line.price_subtotal for line in layout_category['lines'])"/>
                                        <span t-esc="subtotal" t-options="{'widget': 'monetary', 'display_currency': doc.pricelist_id.currency_id}"/>
                                    </td>
                                </tr>
                            </t>

                        </t>
                    </tbody>
                </table>

                <table width="100%" style="border-color:#ffffff !important">
                    <tr>
                        <td style="border-color:#ffffff; border-left-color:#ffffff;" width="65%">
                            <p style="padding:5px"><strong>Montant en lettres : </strong><span t-field="doc.montant_lettre"/></p>
                        </td>
                        <td style="background-color: transparent !important;border-color:#ffffff;" width="35%">
                            <table class="table table-condensed" style="min-width:200px;max-width: 350px;" border="">
                                    <tr class="border-black"  t-if="display_discount"  style="border:1px solid #000000">
                                        <td><strong>Montant sans Remise</strong></td>
                                        <td class="text-right"  style="background-color: transparent !important;">
                                            <span t-field="doc.amount_undiscount"
                                                t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/>
                                        </td>
                                    </tr>
                                    <tr class="border-black"  t-if="display_discount"  style="border:1px solid #000000;">
                                        <td><strong>Remise</strong></td>
                                        <td class="text-right"  style="background-color: transparent !important;">
                                        <span t-field="doc.total_discount"
                                                    t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/>
                                        </td>
                                    </tr>
                                    <tr class="border-black"  style="border:1px solid #000000">
                                        <td><strong>Total H.T.</strong></td>
                                        <td class="text-right"  style="background-color: transparent !important;">
                                           <span t-field="doc.amount_untaxed"
                                                 t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/>
                                        </td>
                                    </tr>
                                    <t t-foreach="doc._get_tax_amount_by_group()" t-as="amount_by_group">
                                        <tr style="border:1px solid #000000;">
                                            <t t-if="amount_by_group[3] == 1 and doc.amount_untaxed == amount_by_group[2]">
                                                <td>
                                                    <span t-esc="amount_by_group[0]"/>
                                                    <span>&amp;nbsp;<span>on</span>&amp;nbsp;<t t-esc="amount_by_group[2]" t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/></span>
                                                    </td>
                                                    <td class="text-right" style="background-color: transparent !important;">
                                                        <span t-esc="amount_by_group[1]"
                                                            t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/>
                                                    </td>
                                                </t>
                                                <t t-else ="">
                                                <td>
                                                    <span t-esc="amount_by_group[0]"/>
                                                </td>
                                                <td class="text-right" style="background-color: transparent !important;">
                                                    <span t-esc="amount_by_group[1]"
                                                        t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/>
                                                </td>
                                            </t>
                                       </tr>
                                    </t>
                                    <tr class="border-black"  style="border:1px solid #000000;">
                                        <td><strong>Total</strong></td>
                                        <td class="text-right"  style="background-color: transparent !important;">
                                            <span t-field="doc.amount_total"
                                                t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/>
                                        </td>
                                    </tr> 

                                    <tr class="border-black"  t-if="(doc.currency_id.name == 'CDF')" style="border:1px solid #000000;">
                                        <td style="border-color:#ffffff;background-color: transparent !important;"></td>
                                    </tr> 

                                    <tr class="border-black"  t-if="(doc.currency_id.name == 'CDF')" style="border:1px solid #000000;">
                                        <td><strong>Taux</strong></td>
                                        <td class="text-right"  style="background-color: transparent !important;">
                                            <span t-field="doc.currency_id.rate"
                                                t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/>
                                        </td>
                                    </tr> 
                                    <tr class="border-black"  t-if="(doc.currency_id.name == 'CDF')" style="border:1px solid #000000;">
                                        <td><strong>Total USD</strong></td>
                                        <td class="text-right"  style="background-color: transparent !important;">
                                            <t t-set="subtotalusd" t-value="(doc.amount_total / doc.currency_id.rate)"/>
                                            <span t-esc="subtotalusd" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
                                            <!--span t-field="doc.currency_id.round(amount_total)"
                                                t-options='{"widget": "monetary", "display_currency": "res_company.currency_id"}'/-->
                                        </td>
                                    </tr> 
                                </table>
                            </td>   
                        </tr>
                        <tr>
                            <td height="10px;" style="border-color:#ffffff;background-color: transparent !important;"></td>
                        </tr>
                    </table>
                    </div>

                <div class="col-xs-12" style="margin-top:10%;">
                    <table style="border-color:#ffffff !important">
                        <tr>
                            <td width="65%" style="border-color:#ffffff;">
                                <table class="table table-condensed" style="min-width: 200px;max-width: 350px;">
                                    <tr class="border-black" style="border:1px solid #000000;">
                                        <td><strong>Prix Rendu:</strong></td>
                                        <td class="text-right" style="background-color: transparent !important;">
                                            <span t-field="doc.prix_rendu"/>
                                        </td>
                                    </tr>
                                    <tr class="border-black" style="border:1px solid #000000;">
                                        <td><strong>Modalité de paiement :</strong></td>
                                        <td class="text-right" style="background-color: transparent !important;">
                                            <span t-field="doc.mode_paiement"/>
                                        </td>
                                    </tr>
                                    <tr class="border-black" style="border:1px solid #000000;">
                                        <td><strong>Validité :</strong></td>
                                        <td class="text-right" style="background-color: transparent !important;">
                                            <span t-field="doc.valide_livraison"/>
                                        </td>
                                    </tr>
                                    <tr class="border-black" style="border:1px solid #000000;">
                                        <td><strong>Livraison :</strong></td>
                                        <td class="text-right" style="background-color: transparent !important;">
                                            <span t-field="doc.livraison"/>
                                        </td>
                                    </tr>
                                    <tr class="border-black" style="border:1px solid #000000;">
                                        <td><strong>Termes et Conditions : -  </strong></td>
                                        <td style="background-color: transparent !important;">
                                            <span><strong>1:- En cas d'exoneration à la T.V.A. veuillez fournir la preuve svp.</strong></span><br/>
                                            <span><strong>2:- Tous les frais bancaires sont à la charge du Client</strong></span><br/>
                                            <span><strong>3:- Tout Client acheteur des produits de sécurité/radio/rabx/réseau est tenu d'obtenir ses propres 
                                            </strong></span>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                            <td width="35%" style="background-color: transparent !important;border-color:#ffffff;"></td>
                            
                        </tr>
                    </table>
                </div>
                <t t-if="page_index &lt; page_size - 1" groups="sale.group_sale_layout">
                    <p style="page-break-before:always;"> </p>
                </t>
            </t>
            <div class="oe_structure"/>
            
        </div>



            </t>
        </t>
    </t>
</template>

<template id="report_saleorder_pro_forma_t">
    <t t-call="web.html_container">
        <t t-foreach="docs" t-as="doc">
            <t t-call="sale_discount.report_invoicess" t-lang="doc.partner_id.lang"/>
        </t>
    </t>
</template>


    <template id="internal_layout_test">
        <!-- Multicompany -->
        <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-raw="0" />
        </div>

        <div class="footer" style="border-top:1px solid #000000">
            <div>
                <img class="img img-responsive" src="/sale_discount/static/img/partners.PNG" /> 
            </div> 
            <div class="text-center" style="border-top:1px dotted #000000">
                <ul class="list-inline mb4">
                    <li t-if="company.street"><span t-field="company.street"/></li>
                </ul>
                <ul class="list-inline mb4">
                    <li t-if="company.phone">Phone: <span t-field="company.phone"/></li>
                    <li t-if="company.email">Email: <span t-field="company.email"/></li>
                    <li t-if="company.website">Web: <span t-field="company.website"/></li>
                    <li t-if="company.vat"><t t-esc="company.country_id.vat_label or 'TIN'"/>: <span t-field="company.vat"/></li>
                </ul>

                <div name="financial_infos">
                    <span t-field="company.report_footer"/>
                </div>

                <div class="text-muted">
                    Page: <span class="page"/> / <span class="topage"/>
                </div>
            </div>
        </div>
    </template>


</odoo>

 


0
Avatar
Discard
Avatar
Hilar Andikkadavath
Best Answer

Goto addons/web/views/report_templates.xml you can see the report_layout template inherit or override the same and do your needs. Include your div here and this will be used for all reports repeatedly, or make your div as a new template and call like header and footer did.

0
Avatar
Discard
Jenish M

I have created my div in other template and when i call using t-call it won't repeat.
Do you know why

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now