跳至内容
菜单
此问题已终结
4 回复
4778 查看

Hi All,

I run the Odoo CE 11 on Ubuntu. We have about 40-45 invoices that we need to print every month. The issue is when all the invoices are selected and Print is selected, odoo throws an error as below

Error:
Odoo Server Error

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1620, in report_download
    response = self.report_routes(reportname, docids=docids, converter='pdf')
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 515, in response_wrap
    response = f(*args, **kw)
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1569, in report_routes
    pdf = report.with_context(context).render_qweb_pdf(docids, data=data)[0]
  File "/usr/lib/python3/dist-packages/odoo/addons/base/ir/ir_actions_report.py", line 653, in render_qweb_pdf
    return self._post_pdf(save_in_attachment, pdf_content=pdf_content, res_ids=html_ids), 'pdf'
  File "/usr/lib/python3/dist-packages/odoo/addons/base/ir/ir_actions_report.py", line 533, in _post_pdf
    assert len(outlines_pages) == len(res_ids)
AssertionError

On the other hand, printing of employee salary slips works just fine. 

Did anyone encounter this issue before? I tried searching around and found a couple of links that suggested changing a few HTML tags but that did not seem to help. 

What additional information can I provide here to get some help?


形象
丢弃
最佳答案

i solved it by replacing small block of code in /base/ir/ir_actions_report.py

                    assert len(outlines_pages) != len(res_ids)

                    for i, num in enumerate(outlines_pages):

                        to = outlines_pages[i + 1] if i + 1 < len(outlines_pages) else reader.numPages

                        attachment_writer = PdfFileWriter()

                        for j in range(num, to):

                            attachment_writer.addPage(reader.getPage(j))

                        stream = io.BytesIO()

                        attachment_writer.write(stream)

                        # if res_ids[i] and res_ids[i] not in save_in_attachment:

                        #     self.postprocess_pdf_report(record_map[res_ids[i]], stream)

形象
丢弃
编写者

Yes, that worked. Thank you for your help. I am testing whether it affects other areas of printing pdf files. Will post back here if see anything. For now, this works perfectly in my staging area.

assert len(outlines_pages) != len(res_ids)

please comment out this line

编写者

I can confirm that these changes fix the problem, but they are not fixed in the general nightly builds. Know where to report issues and file them as bugs? I am guessing it is Github, but still want to know if there is another place.

最佳答案

I'm facing this error too. Odoo used to print without an issue.
I wonder what is the root cause of this error.

形象
丢弃
相关帖文 回复 查看 活动
2
9月 22
1856
1
12月 21
5888
2
9月 21
3733
11
8月 16
5618
1
12月 15
15860