2017-01-31 2 views
0

.xmlの表示データを1ページ(上下に1つ)で定義する方法。私の例では、qwebを生成した後、データは4 pdfページに表示されます!Qwebのレポートを1ページに表示odoo 9

例:

datas = { 
       'ids': ids, 
       'model': 'my.model', 
       'form': data 
       } 
     return { 
       'type': 'ir.actions.report.xml', 
       'report_name': "my_module.my_report", 
       'datas': datas, 
      } 

リターン:[1、2、3、4]

.xmlの1つのPDF documenにデータを表示するためのforeachを定義する方法

<?xml version="1.0" encoding="utf-8"?> 
<openerp> 
<data> 
<template id="report_my_document"> 
    <t t-call="report.html_container"> 
      <t t-call="report.external_layout"> 
       <div class="page"> 
        <table class="table table-condensed"> 
         <thead> 
          <tr> 
           <th>Name</th> 
           <th>State</th> 
          </tr> 
         </thead> 
         <tbody> 
          <tr> 
           <td><t t-esc="o.name"/></td> 
           <td><t t-esc="o.state"/></td> 
          </tr> 
         </tbody> 
        </table> 
      </div> 
     </t> 
    </t> 
</template> 

<template id="report_my"> 
    <t t-call="report.html_container"> 
     <t t-foreach="docs" t-as="o"> 
      <t t-call="my_module.report_my_document"/> 
     </t> 
    </t> 
</template> 
</data> 
</openerp> 

(thead + 4行)

答えて

1

各レコードがテーブル内の行である場合は、これ以上のものが必要です。

<template id="report_my_document"> 
    <t t-call="report.html_container"> 
      <t t-call="report.external_layout"> 
       <div class="page"> 
        <table class="table table-condensed"> 
         <thead> 
          <tr> 
           <th>Name</th> 
           <th>State</th> 
          </tr> 
         </thead> 
         <tbody> 
          <t t-foreach="docs" t-as="o"> 
           <tr> 
            <td><t t-esc="o.name"/></td> 
            <td><t t-esc="o.state"/></td> 
           </tr> 
          </t> 
         </tbody> 
        </table> 
      </div> 
     </t> 
    </t> 
</template> 

<template id="report_my"> 
    <t t-call="report.html_container"> 
     <t t-call="my_module.report_my_document"/> 
    </t> 
</template> 
+0

Good job、Tnx much of! – Pointer

+0

それはあなたのために働いてうれしい! –