Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
4 Odpovědi
4791 Zobrazení

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?


Avatar
Zrušit
Nejlepší odpověď

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)

Avatar
Zrušit
Autor

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

Autor

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.

Nejlepší odpověď

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

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
2
zář 22
1857
1
pro 21
5898
2
zář 21
3741
11
srp 16
5618
1
pro 15
15864