【发布时间】:2017-01-31 15:04:28
【问题描述】:
如何在 .xml 中定义在一页中显示数据(一个在另一个之下)。在我的示例中生成 qweb 后,数据显示在 4 个 pdf 页面上!
例子:
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
<?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>
如何定义foreach以在一个pdf文档中显示数据(thead + 4 row)?
【问题讨论】: