How to update default header in PDF report (qWeb)?

前端 未结 2 1650
臣服心动
臣服心动 2021-01-15 20:36

I have a PDF report, using qWeb in Odoo (v8). My report has this line of code:


This line I supp

相关标签:
2条回答
  • 2021-01-15 20:46

    Hear In Qweb there are Two different classes for set the custom header and Footer in div tag can directly set the custom header set as the header class in div and footer class set as the footer in div tag.important think is that we do not add any external or internal header and footer in your view file Just add the below tag.

    <div class="header">
        <div class="row" style="border-bottom: 1px solid black;">
            <div class="col-xs-3">
                <img t-if="company.logo" t-att-src="'data:image/png;base64,%s' % company.logo" style="max-height: 45px;"/>
                <div t-field="company.partner_id" 
                            t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": true}' />
                </div>
            <div class="col-xs-5 pull-right" style="margin-top:5px;">
                <t t-if="company.vat">
                    <b>GST ID :</b>
                    <span t-field="company.vat" /><br/>
                 </t>
                  <t t-if="company.phone">
                      <b>PHONE :</b>
                      <span t-field="company.phone" /><br/>
                   </t>  
                    <t t-if="company.fax">
                         <b>FAX :</b>
                         <span t-field="company.fax" /><br/>
                     </t>
                     <t t-if="company.email">
                     <b>EMAIL :</b>
                                    <span t-field="company.email" /><br/>
                                </t>
                                <t t-if="company.website">
                                    <b>WEBSITE :</b>
                                    <span t-field="company.website" />
                                </t>
                    </div>
                </div>
            </div>
    
        <div class="footer">
            <div class="text-center" style="border-top: 1px solid black;">
                <ul class="list-inline">
                    <li>Page:</li>
                    <li><span class="page"/></li>
                    <li>/</li>
                    <li><span class="topage"/></li>
                </ul>
            </div>
        </div>
    

    header and footer class automatically set the custome header and footer for that report in Qweb. The code which I showed off you which is working fine from my side.

    I hope this should helpful for you ..:)

    0 讨论(0)
  • 2021-01-15 21:04

    To define your custom header in qweb report by giving a header class to div tab like

    <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>
    
        <div class="footer">
            <div class="row">
                <!-- All your custom code here -->
            </div>
        </div>
    
    </template>
    
    0 讨论(0)
提交回复
热议问题