Skip to Content
Menu
This question has been flagged
1 Reply
4963 Views

I created new qweb report for Sale Order.


I need to include 2 logo in the report. So I wrote new layout for the module which I created a new one.


layout file:


<template id="abc_layout">


    <t t-call="abc.abc_layout_header"/>

    <t t-raw="0" />

    <t t-call="abc.abc_layout_footer"/>

</template>


<template id="abc_layout_header">

    <div class="header">

         <div class="row">

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

     <img class="img img-responsive" src="/abc/static/src/img/abc.png" style="max-height: 45px;"/>

    </div>

             <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>

         </div>

    </div>

</template>


<template id="abc_layout_footer">


    <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>      


</template>



report xml file



<template id="report_saleorder_approval_view">

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

      <t t-set="data_report_margin_top" t-value="12"/>

      <t t-set="data_report_header_spacing" t-value="9"/>

      <t t-set="data_report_dpi" t-value="110"/>

      <t t-foreach="docs" t-as="o">

      <t t-call="abc.abc_layout">

          <div class="page">

              <div class="oe_structure"/>

              


              <div class="text-center"><p style="font-size:14px;"><b><u>Approval View</u></b></p></div>

             

     <div class="row mt32 mb32" style="font-size:14px;">

      <div class="col-xs-offset-0 col-xs-4">

       <span class="text-left" t-if="o.name">Our Ref : <b><span t-field="o.name"/></b></span>

      </div>

     </div>

     <div style="font-size:10px;">

         <table class="table table-bordered" style="border: 2px solid black;">

             <thead>

                 <tr style="border: 2px solid black; font-size:10px;">

                  <th class="text-center" style="border: 1px solid black; background-color:#CC0000;">Product Description</th>

                     <th class="text-center" style="border: 1px solid black; background-color:#CC0000;">Quantity</th>

                     <th class="text-center" style="border: 1px solid black; background-color:#CC0000;">Rate</th>

                     <th class="text-center" style="border: 1px solid black; background-color:#CC0000;">Discount in Percentage</th>

                     <th class="text-center" style="border: 1px solid black; background-color:#CC0000;">Discount in Value</th>

                     <th class="text-center" style="border: 1px solid black; background-color:#CC0000;">Rate after Discount</th>

                     <th class="text-center" style="border: 1px solid black; background-color:#CC0000;">Amount</th>

                 </tr>

             </thead>

             <tbody>

              <tr style="border: 2px solid black; page-break-inside: avoid" t-foreach="o.order_line" t-as="l">

               <td style="border: 2px solid black; font-size:9px;"><span t-field="l.product_id.name"/></td>

                     <td class="text-right" style="border: 2px solid black;"><span t-field="l.product_uom_qty"/></td>

                     <td class="text-right" style="border: 2px solid black;"><span t-field="l.price_unit"/></td>

                     <td class="text-right" style="border: 2px solid black;"><span t-field="l.discount"/></td>

                     <td class="text-right" style="border: 2px solid black;"><span t-esc="get_discount_in_value(l)"/></td>

                     <td class="text-right" style="border: 2px solid black;"><span t-field="l.price_subtotal"/></td>

                     <td class="text-right" style="border: 2px solid black;"><span t-esc="get_amount(l)"/></td>

              </tr>

             </tbody>

             </table>

          </div>


    </div>

    </t>

    </t>

   </t>

  </template>


But the header and footer not visible in the pdf. Layout is not functioning. So I simply tried report.external_layout in the report xml. This is also not working.

Avatar
Discard
Author Best Answer

I find it. The problem is wkhtmltopdf. I have wkhtmltopdf 0.12.2.4 version. I checked this code in another system with wkhtmltopdf 0.12.2.1(Patched qt)  version. It works correctly. i tried to install wkhtmltopdf 0.12.2.1(Patched qt) in ubuntu 16.04 but it is not installed. 

How to install wkhtmltopdf patched qt version in ubuntu 16.04

Avatar
Discard