Skip to content
Snippets Groups Projects
Commit 94465e17 authored by Stefan-Calin Crainiciuc (stcc)'s avatar Stefan-Calin Crainiciuc (stcc)
Browse files

[FIX] base: fix batch report outlines traceback

Steps to reproduce:

Accounting app > Customers > Invoices
- Create invoice with customer and a couple of products
- In the terms & conditions tab at the bottom, add 20-30 empty lines
and then a heading (/h1-3) with some text. This insures that the printed
report will have more than 1 page.
- Go back to the Invoices list view
- Select the invoice + another random one > Print > Invoices

A traceback appears in _post_pdf: Assertion error
`assert len(outlines_pages) == len(res_ids)`

When printing a PDF file, `wkhtmltopdf` generates a number of `outlines`
equal to the number of headings (`<h1-6>`) in the printed document.
When printing multiple documents, the logic requires that each document
should have all of its headings on one page.

The traceback is raised because one document has headings on more
than one page.

The information about which `outlines` correspond to which document is
lost during the pdf creation process, so there is no easy way to reason
about the length of each document after the pdf is created.

Solution:

If there are more outlines then expected, then the matching fails and
each part of the PDF will not be saved as attachment, similarly to https://github.com/odoo/odoo/pull/25496



opw-2882507

closes odoo/odoo#99141

Signed-off-by: default avatarOlivier Dony <odo@odoo.com>
parent c0d86e0f
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment