Preview Attachment : Images, PDFs, Office docs, videos, etc.
by Steven Marp https://apps.odoo.com/apps/browse?repo_maintainer_id=512936$ 70.87
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Lines of code | 456 |
| Technical Name |
sm_preview_attachment |
| License | LGPL-3 |
| Website | https://apps.odoo.com/apps/browse?repo_maintainer_id=512936 |
| Versions | 17.0 18.0 19.0 |
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Lines of code | 456 |
| Technical Name |
sm_preview_attachment |
| License | LGPL-3 |
| Website | https://apps.odoo.com/apps/browse?repo_maintainer_id=512936 |
| Versions | 17.0 18.0 19.0 |
📎 SM Preview Attachment
Preview Binary Fields & Attachments directly in Odoo 17
Version 2.0.0📖 Overview
SM Preview Attachment adds preview buttons to Binary fields and attachment fields in Odoo 17 forms and list views. Preview images, PDFs, Office documents, videos, and more without downloading files!
✅ Odoo 17 Community & Enterprise
Fully compatible with both Odoo 17 Community and Enterprise editions. This module uses OWL 2 component system.
ℹ️ Complements Built-in Features
Odoo 18+ Enterprise has built-in chatter attachment preview. This module adds preview buttons to Binary fields and Many2Many attachment fields in form/list views - features not included in the built-in preview.
🚀 Key Features
Preview Button on Binary Fields
One-click preview button appears next to Binary fields with files (images, PDFs, documents)
Attachment Field Support
Preview attachments from Many2Many Binary fields commonly used in Odoo forms
Modal Preview
Clean fullscreen modal viewer for images, PDFs, and embedded document preview
Office Document Support
Preview Word, Excel, PowerPoint via Office Online or Google Docs Viewer
Download Button
Quick download option available in the preview modal header
Keyboard Shortcuts
Press ESC to close modal quickly for efficient workflow
📋 Supported File Formats
| Type | Extensions | Preview Method |
|---|---|---|
| 🖼️ Images | PNG JPG JPEG GIF BMP SVG WEBP |
Native browser |
PDF |
Browser PDF viewer | |
| 📝 Word | DOC DOCX ODT |
Office Online / Google Docs |
| 📊 Excel | XLS XLSX ODS |
Office Online / Google Docs |
| 📽️ PowerPoint | PPT PPTX ODP |
Office Online / Google Docs |
| 🎬 Video | MP4 WEBM OGG |
HTML5 video player |
| 🎵 Audio | MP3 WAV OGG M4A |
HTML5 audio player |
| 📄 Text | TXT CSV JSON XML HTML |
Text viewer |
🔧 How It Works
Binary Field Preview
When a Binary field contains a file (e.g., employee photo, product attachment, document), a "Preview" button automatically appears next to the filename. Click to open the file in a modal viewer.
Many2Many Attachment Preview
For Many2Many Binary fields (attachment lists), each attachment row shows a preview button. Supports both form view and list view displays.
Office Document Preview
⚠️ Office Preview Requirements
For Office documents (Word, Excel, PowerPoint), the module uses external services:
- Public URLs: Uses Office Online viewer (view.officeapps.live.com)
- Private/Localhost: Shows download modal with option to use Google Docs Viewer
📥 Installation
-
Download Module
Download and extract the
sm_preview_attachmentfolder to your Odoo addons directory. - Update Apps List Go to Apps menu and click "Update Apps List" (requires developer mode).
- Install Module Search for "SM Preview Attachment" and click Install.
⚙️ Technical Information
Dependencies
This module only depends on web (base Odoo web module).
OWL Components Patched
BinaryField- Adds preview button for single file Binary fieldsMany2ManyBinaryField- Adds preview buttons for attachment list fields
Module Structure
sm_preview_attachment/
├── __init__.py
├── __manifest__.py
├── README.md
└── static/
├── description/
│ ├── banner.gif
│ ├── icon.png
│ └── index.html
└── src/
├── css/
│ └── preview.css
├── js/
│ └── attachment_preview.js
└── xml/
└── attachment_preview.xml
Please log in to comment on this module