Skip to content

[16.0] [ADD] Add web_preview_attachment module#1

Open
P-H-Phuc wants to merge 3 commits into16.0from
16.0-add-base-preview-attachment
Open

[16.0] [ADD] Add web_preview_attachment module#1
P-H-Phuc wants to merge 3 commits into16.0from
16.0-add-base-preview-attachment

Conversation

@P-H-Phuc
Copy link
Copy Markdown
Owner

@P-H-Phuc P-H-Phuc commented Jul 2, 2025

  • Depend to this module to add your own preview types.
  • Example of a custom preview type:
   /** @odoo-module **/

import { patch } from "@web/core/utils/patch";
import { Many2ManyBinaryField } from "@web/views/fields/many2many_binary/many2many_binary_field";

patch(
    Many2ManyBinaryField.prototype,
    "yourModule.AttachmentPreview",
    {
        isPreviewable(file) {
            if (file.mimetype === "special_mimetype") {
                return true;
            }
            return this._super.apply(this, arguments);
        },
    }
);

@@ -0,0 +1,3 @@
* `Trobz <https://trobz.com>`_:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@P-H-Phuc you can check link format to follow markdown syntax.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filename should be CONTRIBUTORS.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants