This commit is contained in:
Bhavesh Heliconia 2025-06-24 19:00:20 +00:00 committed by GitHub
commit fbeea792c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,16 +1,16 @@
/** @odoo-module **/
/* eslint-disable no-undef */
import AttachmentPreviewWidget from "../../attachmentPreviewWidget.esm";
import FormRenderer from "web.FormRenderer";
import {registerInstancePatchModel} from "@mail/model/model_core";
odoo.define("attachment_preview.attachment_card", function (require) {
var rpc = require("web.rpc");
var rpc = require("web.rpc");
var chatterpreviewableAttachments = [];
var active_attachment_id = 0;
var first_click = true;
var chatterpreviewableAttachments = [];
var active_attachment_id = 0;
var first_click = true;
FormRenderer.include({
FormRenderer.include({
custom_events: _.extend({}, FormRenderer.prototype.custom_events, {
onAttachmentPreview: "_onAttachmentPreview",
}),
@ -58,9 +58,9 @@ odoo.define("attachment_preview.attachment_card", function (require) {
first_click = true;
this.showAttachmentPreviewWidget(first_click);
},
});
});
function canPreview(extension) {
function canPreview(extension) {
return (
$.inArray(extension, [
"odt",
@ -75,14 +75,9 @@ odoo.define("attachment_preview.attachment_card", function (require) {
"ots",
]) > -1
);
}
}
function getUrl(
attachment_id,
attachment_url,
attachment_extension,
attachment_title
) {
function getUrl(attachment_id, attachment_url, attachment_extension, attachment_title) {
var url = "";
if (attachment_url) {
if (attachment_url.slice(0, 21) === "/web/static/lib/pdfjs") {
@ -115,9 +110,9 @@ odoo.define("attachment_preview.attachment_card", function (require) {
"?model%3Dir.attachment";
return url;
}
}
registerInstancePatchModel(
registerInstancePatchModel(
"mail.attachment_card",
"attachment_preview/static/src/js/models/attachment_card/attachment_card.js",
{
@ -261,5 +256,4 @@ odoo.define("attachment_preview.attachment_card", function (require) {
});
},
}
);
});
);