[FW][FIX] base: cut multipage multi-documents on top heading #48360
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When we print a report for multiple records, we call wkhtmltopdf one
time and to save each document separately, we will split the PDF based
on its outline if it is available.
The outline is generated by wkhtmltopdf based on headings
(H1,H2,H3,H4,H5,H6,H7,H8,H9 elements) for example this document:
has this abbreviated outline structure:
But the current heuristic did not take into account level of headings,
so if the document had a lower-level headings this could break the
multi-printing of these reports.
So for the example above, the document would be cut in 3 when in reality
we only want to cut it twice over the top level heading (
<h1/>
here).An existing issue in Odoo is in l10n_in_sale,
<h6/>
element are addedto the report invoice line so instead of only one
<h2/>
headingcontaining the invoice name per document, there was an additional
heading per invoice line which broke the heuristic.
note: we also add an assertion to ensure first heading is on first page
opw-2188767
Forward-Port-Of: #48143
Forward-Port-Of: #48099