Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
4 Trả lời
4820 Lượt xem

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?


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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)

Ảnh đại diện
Huỷ bỏ
Tác giả

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

Tác giả

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.

Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 9 22
1894
1
thg 12 21
5943
2
thg 9 21
3760
11
thg 8 16
5663
1
thg 12 15
15912