mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-16 04:02:56 -06:00
[IMP]attachment_preview: Fix issue with attachment JS not loading properly.
This commit is contained in:
parent
3ca5b22649
commit
b13d72e5e8
@ -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) {
|
||||
});
|
||||
},
|
||||
}
|
||||
);
|
||||
});
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user