尝试下载多张发票时出错

时间:2018-04-03 07:54:38

标签: odoo-11

我修改了发票报告模板" account.report_invoice_document"。

XML代码:

<template id="report_invoice_document_inherit" inherit_id="account.report_invoice_document">
    <xpath expr="//div[@class='page']" position="inside">
        <div class="row">
            <div class="text-left">
                <h4><u>Comments</u></h4>
            </div>
            <div class="text-justify" style="margin-left:10px;">
                <p>Data</p>
            </div>
        </div>
    </xpath>
</template>

当我尝试下载多张发票时,终端上没有显示错误。

从表单视图下载时,

Invoice Report已成功下载。从account.invoice树视图下载多个报告时出错。

我在odoo上收到了错误。

 Error:
    Odoo Server Error

    Traceback (most recent call last):
      File "/home/odoo/Documents/odoo11_community/odoo-11.0/addons/web/controllers/main.py", line 1663, in report_download
        response = self.report_routes(reportname, docids=docids, converter='pdf')
      File "/home/odoo/Documents/odoo11_community/odoo-11.0/odoo/http.py", line 512, in response_wrap
        response = f(*args, **kw)
      File "/home/odoo/Documents/odoo11_community/odoo-11.0/addons/web/controllers/main.py", line 1612, in report_routes
        pdf = report.with_context(context).render_qweb_pdf(docids, data=data)[0]
      File "/home/odoo/Documents/odoo11_community/odoo-11.0/odoo/addons/base/ir/ir_actions_report.py", line 641, in render_qweb_pdf
        return self._post_pdf(save_in_attachment, pdf_content=pdf_content, res_ids=html_ids), 'pdf'
      File "/home/odoo/Documents/odoo11_community/odoo-11.0/odoo/addons/base/ir/ir_actions_report.py", line 524, in _post_pdf
        assert len(outlines_pages) == len(res_ids)
    AssertionError

1 个答案:

答案 0 :(得分:0)

尝试替换该行:

  

<h4><u>Comments</u></h4>

作者:

  

<p><u>Comments</u></p>

问题是<h4>标签。

Odoo 11中的源代码(odoo / addons / base / ir / ir_actions_report.py)有助于:

                # In case of multiple docs, we need to split the pdf according the records.
                # To do so, we split the pdf based on outlines computed by wkhtmltopdf.
                # An outline is a <h?> html tag found on the document. To retrieve this table,
                # we look on the pdf structure using pypdf to compute the outlines_pages that is
                # an array like [0, 3, 5] that means a new document start at page 0, 3 and 5.