Friday, May 7, 2021
1 change · master
Resolved issues and error corrections
Odoo now hides PDF viewer buttons for printing, downloading, and opening files when they do not work properly inside mobile app webviews. This prevents users from seeing options that fail or do not make sense, while keeping other ways to access files available.
Original PR description
Some features of the PDF.js library doesn't work in the webview of the mobile apps. Initially 'window.print' is defined as an empty function in webviews unlike browsers where it is already ready.…
Some features of the PDF.js library doesn't work in the webview of the mobile apps. Initially 'window.print' is defined as an empty function in webviews unlike browsers where it is already ready. After that, PDF.js needs to monkey patch 'window.print' and saves a reference to the original definition, which is not yet fulfilled in by the mobile app (Java part). So the print of PDF.js doesn't work in webviews and end users will need to download the file before printing it. Regarding the Download button, the 'download' attribute is not supported by the webview as you can see in: https://bugs.chromium.org/p/chromium/issues/detail?id=432414 As there's many ways to download a file in Odoo it's not a big deal to simply hide it in PDF.js. Because it's quite complicated to fix this, we decided to hide the features that don't work (Download / Print) or don't make sense (Open file). Task-id: 2200168 -- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr