Report 一页Qweb报告odoo 9

Report 一页Qweb报告odoo 9,report,openerp,qweb,Report,Openerp,Qweb,如何在.xml中定义在一个页面中显示数据(一个页面在另一个页面下面)。在我的示例中生成qweb后,数据显示在4PDF页面上 例如: datas = { 'ids': ids, 'model': 'my.model', 'form': data } return { 'type': 'ir.actions.report

如何在.xml中定义在一个页面中显示数据(一个页面在另一个页面下面)。在我的示例中生成qweb后,数据显示在4PDF页面上

例如:

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


名称
陈述

如何定义foreach以在一个pdf文档中显示数据(thead+4行)

如果每个记录都是表中的一行,您可能需要类似的内容

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

名称
陈述

干得好,Tnx很多!
<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>