Python QWEB-索引器错误:列表索引超出范围
我正在尝试创建一个QWeb报告。我有一份产品清单,我想把每种礼仪都打印在同一页上。这是我的代码:Python QWEB-索引器错误:列表索引超出范围,python,openerp,odoo-8,qweb,Python,Openerp,Odoo 8,Qweb,我正在尝试创建一个QWeb报告。我有一份产品清单,我想把每种礼仪都打印在同一页上。这是我的代码: <?xml version="1.0" encoding="utf-8"?> <openerp> <data> <!-- Déclaration des rapports --> <report id="etiquette_produit"
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Déclaration des rapports -->
<report
id="etiquette_produit"
model="product.template"
string="Etiquette Produit"
report_type="qweb-pdf"
file="Product_Etiquette_QWeb.produit_etiquette"
name="Product_Etiquette_QWeb.produit_etiquette"
/>
<template id="produit_etiquette">
<t t-call="report.external_layout">
<t t-foreach="docs" t-as="o">
<div class="page">
<table class="table table-striped">
<tr>
<td class="col-xs-1"><span t-field="o.default_code"/></td>
<td class="col-xs-5 text-center"><span t-field="o.name"/></td>
<td class="col-xs-1"><span t-field="o.default_code"/></td>
<td class="col-xs-5 text-center"><span t-field="o.name"/></td>
</tr>
<tr>
<td colspan="2" class="text-center">* M E 2 1 5 9 *</td>
<td colspan="2" class="text-center">* M E 2 0 1 7 *</td>
</tr>
</table>
</div>
</t>
</t>
</template>
</data>
</openerp>
有什么想法吗?这个问题与报表引擎希望每个页面有一个页眉和页脚这一事实有关。您正在为1个页眉+页脚创建N个页面 调用
必须放在for循环中。如果您在同一页面中需要多个项目,请不要使用page
类作为包装器,因为引擎使用包装器来获取报告页面。你可以看一看
Odoo Server Error
Traceback (most recent call last):
File "/opt/odoo/odoo-server/addons/report/controllers/main.py", line 116, in report_download
response = self.report_routes(reportname, docids=docids, converter='pdf')
File "/opt/odoo/odoo-server/openerp/http.py", line 405, in response_wrap
response = f(*args, **kw)
File "/opt/odoo/odoo-server/addons/report/controllers/main.py", line 65, in report_routes
pdf = report_obj.get_pdf(cr, uid, docids, reportname, data=options_data, context=context)
File "/opt/odoo/odoo-server/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/odoo/odoo-server/addons/report/models/report.py", line 275, in get_pdf
paperformat, specific_paperformat_args, save_in_attachment
File "/opt/odoo/odoo-server/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/odoo/odoo-server/addons/report/models/report.py", line 432, in _run_wkhtmltopdf
head_file.write(headers[index])
IndexError: list index out of range