如何在.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文档中显示数据(头+4行)
发布于 2017-01-31 20:02:08
如果每条记录都是表中的一行,则可能需要更多类似的内容。
<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>https://stackoverflow.com/questions/41960836
复制相似问题