From 54860e01e1925b023bbfc23c692c7e663cb19ce6 Mon Sep 17 00:00:00 2001 From: Carlos Quiros Date: Wed, 19 Oct 2016 13:52:21 -0600 Subject: [PATCH] [FIX] - attachment_preview: Migrated the module to 9.0 version and fixed some errors displaying the attachments files. --- .../static/src/js/attachment_preview.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/attachment_preview/static/src/js/attachment_preview.js b/attachment_preview/static/src/js/attachment_preview.js index 38ba3dd5..d42fd69a 100644 --- a/attachment_preview/static/src/js/attachment_preview.js +++ b/attachment_preview/static/src/js/attachment_preview.js @@ -31,14 +31,14 @@ odoo.define('attachment_preview', function (require) { var _t = core._t; function show_preview(attachment_id, attachment_url, attachment_extension, attachment_title) { - var url = (window.location.origin || '') + + var url = ((window.location.origin || '') + '/attachment_preview/static/lib/ViewerJS/index.html' + '?type=' + encodeURIComponent(attachment_extension) + '&title=' + encodeURIComponent(attachment_title) + '#' + - attachment_url.replace(window.location.origin, '') + attachment_url.replace(window.location.origin, '')); window.open(url); - }; + } function can_preview(extension) { return jQuery.inArray( @@ -47,7 +47,7 @@ odoo.define('attachment_preview', function (require) { 'odt', 'odp', 'ods', 'fodt', 'pdf', 'ott', 'fodp', 'otp', 'fods', 'ots' ]) > -1; - }; + } Sidebar.include({ on_attachments_loaded: function(attachments) { @@ -104,8 +104,8 @@ odoo.define('attachment_preview', function (require) { _(extensions).each(function(extension, id) { var $element = jQuery( - 'span.oe_sidebar_attachment_preview[data-id="' - + id + '"]'); + 'span.oe_sidebar_attachment_preview[data-id="'+ + id + '"]'); if(can_preview(extension[0])) { $element.attr('data-extension', extension[0]); @@ -238,7 +238,7 @@ odoo.define('attachment_preview', function (require) { else { this.$('.oe_binary_preview').remove(); - }; + } }, }); });