[17.0][ADD] attachment_preview_office: preview Office attachments via LibreOffice conversion - #635
[17.0][ADD] attachment_preview_office: preview Office attachments via LibreOffice conversion#635alan196 wants to merge 1 commit into
Conversation
12b960e to
41623e2
Compare
|
Update: the preview button is now hidden when LibreOffice is not available on the server, instead of opening the viewer with an HTTP 503 error (the availability is exposed through Note for reviewers: the runboat image (oca-ci) does not ship LibreOffice, so on runboat the preview button will simply not appear for office files — the feature itself cannot be demoed there. To test functionally, run locally with |
41623e2 to
20db219
Compare
|
Improved spreadsheet rendering: XLSX/XLS/ODS are now converted with LibreOffice's |
20db219 to
007cc34
Compare
|
Added a loading indicator for slow conversions: since the PDF.js iframe gives no feedback while the server converts a large document, the FileViewer now shows a spinner ("Generating preview… Large files can take several seconds.") and warms the conversion cache with a fetch before mounting the iframe, which then loads instantly from the cache. Includes Spanish translation. |
|
Compatibility fix for LibreOffice < 7.4: the CLI JSON filter-options syntax ( |
007cc34 to
bf5bf30
Compare
…Office Convert DOCX/XLSX/PPTX (and legacy/ODF) attachments to PDF server-side with LibreOffice headless and render them with Odoo's native PDF.js viewer, including chatter attachments. No external viewer service is involved, so documents never leave the server. Converted PDFs are cached on disk keyed by content checksum. Conversion endpoint logic based on OCA#603 (18.0).
bf5bf30 to
b57e6e3
Compare
Summary
New module that previews office documents (DOCX, XLSX, PPTX, DOC, XLS, PPT, ODT, ODS, ODP, ODG) in the browser — including chatter attachments — by converting them to PDF server-side with LibreOffice headless and rendering the result with Odoo's native PDF.js viewer.
Nothing leaves the server: no external viewer service (Microsoft Office Online, Google Docs) is involved, which makes it suitable for sensitive documents.
Context
attachment_previewwas never migrated to 17.0 and its ViewerJS-based approach only covers PDF + ODF anyway.attachment_previewon 18.0 via LibreOffice conversion. This module brings the same conversion-endpoint logic to 17.0, but as a small standalone module: on 17.0 the native FileViewer already renders PDFs, so no ViewerJS or base module is needed.How it works
GET /attachment_preview_office/to_pdf?model=&field=&id=&filename=converts the binary field content to PDF withlibreoffice --headless --convert-to pdf(isolatedUserInstallationprofile per conversion, checksum-keyed disk cache under the filestore).Attachmentmodel marks office extensions as previewable (isPdf) and routesdefaultSourcethrough the conversion endpoint wrapped in the native PDF.js viewer. The Download button still returns the original file.subprocess/tempfileonly).Test plan