[17.0][ADD] mail_attachment_office_preview: preview Office attachments via LibreOffice conversion - #258
Open
alan196 wants to merge 2 commits into
Open
Conversation
Reyes4711-S73
pushed a commit
to Studio73/mail
that referenced
this pull request
Aug 26, 2026
Testing this addon failed if i.e. `mass_mailing_list_dynamic` was installed before. Moving tests to post-install mode fixes integration tests.
Member
|
This module can't be tested, as the LibreOffice headless server is not included. Isn't this another way to preview them? |
Contributor
Author
|
Added |
Contributor
Author
|
The red CI here is not caused by this PR: both failures are in |
alan196
force-pushed
the
17.0-add-mail_attachment_office_preview
branch
from
August 28, 2026 21:11
245e4b2 to
d8b614b
Compare
pedrobaeza
approved these changes
Aug 30, 2026
pedrobaeza
left a comment
Member
There was a problem hiding this comment.
Tested on runboat and working. Please squash both commits into one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Replaces OCA/knowledge#635: moved here and renamed following the same naming criteria as #257 (@pedrobaeza's suggestion), since the module is about mail attachments and is not a derivative of
attachment_preview.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 /mail_attachment_office_preview/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