早上好,请帮助我,我想从报告中删除所有公司信息,但发生错误。
这是我的代码:
<template id="empty_report" inherit_id="web.external_layout_standard">
<xpath expr="//div[@class='header']" position="replace">
<div class="header">
<div class="row">
<div class="col-3 mb4">
</div>
</div>
</div>
</xpath>
<xpath expr="//div/div/ul[@class='list-inline mb4']" position="replace">
</xpath>
<xpath expr="//div/div/div[@name='financial_infos']" position="replace">
<div name="financial_infos">
</div>
</xpath>
</template>
这里是错误:
Odoo Server Error
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1671, in report_download
response = self.report_routes(reportname, docids=docids, converter=converter)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 519, in response_wrap
response = f(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1612, in report_routes
pdf = report.with_context(context).render_qweb_pdf(docids, data=data)[0]
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions_report.py", line 716, in render_qweb_pdf
bodies, html_ids, header, footer, specific_paperformat_args = self.with_context(context)._prepare_html(html)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions_report.py", line 346, in _prepare_html
body_parent = root.xpath('//main')[0]
IndexError: list index out of range
但是当我从此URL访问PDF时,它工作得很好:
http://localhost:8069/report/pdf/stock.report_deliveryslip/1
但是当我尝试从“打印”按钮访问并给我上面的错误时,它不起作用。
谢谢您的帮助!
问候
如果您不希望仅在报表页眉/页脚上使用公司信息,web.basic_layout而不是web.external_layout_standard或者您也可以通过自己的客户页眉/页脚进行处理。与您的代码一样,这也会对另一个链接报告产生影响。