Wednesday, January 4, 2023
1 change · master
Resolved issues and error corrections
PDF reports now handle page headers and footers correctly when printing batches that include right-to-left languages such as Arabic alongside left-to-right languages. This prevents corrupted or unreadable documents in large batch prints, improving reliability for sales, purchasing, and stock-related paperwork.
Original PR description
When selecting at least 10 SO with RTL language on the customer, the printing behavior (the PDF produced) is inconsistent. By inconsistent, we mean some pages are completely filled with buggy headers…
When selecting at least 10 SO with RTL language on the customer, the printing behavior (the PDF produced) is inconsistent. By inconsistent, we mean some pages are completely filled with buggy headers making the whole PDF corrupted (on a business point of view). Step to reproduce the issue: The customer/vendor on the PO, SO, RFQ has language set to Arabic The user creating the document has language set to English (US) Printing out 10+ documents The resulting PDF document is inconsistent and contains headers issues (as previously stated). Solution: The problem is that the headers/footers doesn't take into account the language of the company (RTL or not). In fact, all the headers/footers of a batch print are contained into a single HTML file (apparently, at the time, wkhtmltopdf did not support multiple headers/footers). A Javascript script is used to select the appropriate header/footer for each page of the PDF. The issue is that the CSS file used for these headers/footers is always a LTR CSS file. Moreover, with this design, it is impossible to combine headers/footers in RTL and LTR into a single PDF file with multiple pages. The complete solution would be to create a single header/footer file per page in the PDF report (wkhtmltopdf now supports this), that way we can specify the language (RTL or LTR) for each of the page and have the perfect behavior. However, this change cannot be applied into a stable version (requires changes in signature of methods, etc.), consequently, the full solution will only be kept for master. Enterprise PR: https://github.com/odoo/enterprise/pull/26289 Original PR on stable version: https://github.com/odoo/odoo/pull/88883 opw-2734671