diff --git a/muk_web_preview_attachment/README.md b/muk_web_preview_attachment/README.md deleted file mode 100644 index caaf30e..0000000 --- a/muk_web_preview_attachment/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# MuK Preview Attachment - -Adds a button to the Attachment Sidebar to preview the content directly in the browser. -The module also enables the possibility to preview attachment in the Odoo Chat Widgets. \ No newline at end of file diff --git a/muk_web_preview_attachment/__init__.py b/muk_web_preview_attachment/__init__.py index e683dbc..3a632f4 100644 --- a/muk_web_preview_attachment/__init__.py +++ b/muk_web_preview_attachment/__init__.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - ################################################################################### # # Copyright (C) 2017 MuK IT GmbH diff --git a/muk_web_preview_attachment/__manifest__.py b/muk_web_preview_attachment/__manifest__.py index 8512773..80048b7 100644 --- a/muk_web_preview_attachment/__manifest__.py +++ b/muk_web_preview_attachment/__manifest__.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - ################################################################################### # # Copyright (C) 2017 MuK IT GmbH @@ -22,16 +20,11 @@ { "name": "MuK Preview Attachment", "summary": """Attachment Preview Dialog""", - "description": """ - Adds a button to the Attachment Sidebar to - preview the content directly in the browser. - The module also enables the possibility to - preview attachment in the Odoo Chat Widgets. - """, - "version": "11.0.1.0.6", + "version": "11.0.2.0.0", "category": "Extra Tools", "license": "AGPL-3", "website": "http://www.mukit.at", + "live_test_url": "https://demo.mukit.at/web/login", "author": "MuK IT", "contributors": [ "Mathias Markl ", @@ -45,8 +38,6 @@ "template/assets.xml", "views/ir_attachment_view.xml", ], - "demo": [ - ], "qweb": [ "static/src/xml/*.xml", ], diff --git a/muk_web_preview_attachment/doc/changelog.rst b/muk_web_preview_attachment/doc/changelog.rst index 9ee2b48..64b9512 100644 --- a/muk_web_preview_attachment/doc/changelog.rst +++ b/muk_web_preview_attachment/doc/changelog.rst @@ -1,3 +1,9 @@ +`2.0.0` +------- + +- Migrated to Python 3 +- Support for FieldMany2ManyBinaryMultiFiles Widget + `1.0.0` ------- diff --git a/muk_web_preview_attachment/doc/index.rst b/muk_web_preview_attachment/doc/index.rst new file mode 100644 index 0000000..8145303 --- /dev/null +++ b/muk_web_preview_attachment/doc/index.rst @@ -0,0 +1,48 @@ +====================== +MuK Preview Attachment +====================== + +Adds a button to the Attachment Sidebar to preview the content directly in the +browser. The module also enables the possibility to preview attachment in the +Odoo Chat Widgets. + +Installation +============ + +To install this module, you need to: + +Download the module and add it to your Odoo addons folder. Afterward, log on to +your Odoo server and go to the Apps menu. Trigger the debug modus and update the +list by clicking on the "Update Apps List" link. Now install the module by +clicking on the install button. + +Configuration +============= + +No additional configuration is needed to use this module. + +Usage +============= + +Attachment views as well as attachments in the chatter widgets can be previewed +using the Preview dialog. + +Credits +======= + +Contributors +------------ + +* Mathias Markl + +Author & Maintainer +------------------- + +This module is maintained by the `MuK IT GmbH `_. + +MuK IT is an Austrian company specialized in customizing and extending Odoo. +We develop custom solutions for your individual needs to help you focus on +your strength and expertise to grow your business. + +If you want to get in touch please contact us via mail +(sale@mukit.at) or visit our website (https://mukit.at). diff --git a/muk_web_preview_attachment/models/__init__.py b/muk_web_preview_attachment/models/__init__.py index f303a72..83e9d0f 100644 --- a/muk_web_preview_attachment/models/__init__.py +++ b/muk_web_preview_attachment/models/__init__.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - ################################################################################### # # Copyright (C) 2017 MuK IT GmbH diff --git a/muk_web_preview_attachment/models/ir_attachment.py b/muk_web_preview_attachment/models/ir_attachment.py index 6109284..35a4ff6 100644 --- a/muk_web_preview_attachment/models/ir_attachment.py +++ b/muk_web_preview_attachment/models/ir_attachment.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - ################################################################################### # # Copyright (C) 2017 MuK IT GmbH @@ -19,13 +17,10 @@ # ################################################################################### -import base64 -import collections import logging import mimetypes import os.path -from odoo import _ from odoo import models, api, fields _logger = logging.getLogger(__name__) diff --git a/muk_web_preview_attachment/static/description/demo.gif b/muk_web_preview_attachment/static/description/demo.gif index 14e905f..501c75c 100644 Binary files a/muk_web_preview_attachment/static/description/demo.gif and b/muk_web_preview_attachment/static/description/demo.gif differ diff --git a/muk_web_preview_attachment/static/description/index.html b/muk_web_preview_attachment/static/description/index.html index 09d1bf3..0f5eeca 100644 --- a/muk_web_preview_attachment/static/description/index.html +++ b/muk_web_preview_attachment/static/description/index.html @@ -4,7 +4,7 @@

Preview your attachments directly in Odoo.

MuK IT GmbH - www.mukit.at

-
+
@@ -12,7 +12,7 @@
-
+

Overview

Adds a button to the Attachment Sidebar to preview the content directly in the browser. The module also enables @@ -49,14 +49,46 @@

+
+

Demo

+
+
+
User:
+
+
+
apps
+
+
+
Password:
+
+
+
demo
+
+
+ +
+

Help and Support

+
Feel free to + contact us, if you need any help with your Odoo integration or + addiontal features.
. +* +**********************************************************************************/ + +odoo.define('muk_preview_attachment.WidgetPreview', function (require) { +"use strict"; + +var core = require('web.core'); +var session = require('web.session'); +var fields = require('web.relational_fields'); + +var PreviewHelper = require('muk_preview_attachment.PreviewHelper'); + +var QWeb = core.qweb; +var _t = core._t; + +fields.FieldMany2ManyBinaryMultiFiles.include({ + init: function() { + this._super.apply(this, arguments); + this.events = _.extend(this.events, { + 'click .oe_attachment .o_image': '_preview', + 'click .o_attachment_preview': '_preview', + }); + }, + _preview: function(e) { + e.preventDefault(); + e.stopPropagation(); + PreviewHelper.createAttachmentPreview( + $(e.currentTarget).data('id'), this); + }, +}); + +}); \ No newline at end of file diff --git a/muk_web_preview_attachment/static/src/less/sidebar_preview.less b/muk_web_preview_attachment/static/src/less/sidebar_preview.less index 7edf21d..1d414ac 100644 --- a/muk_web_preview_attachment/static/src/less/sidebar_preview.less +++ b/muk_web_preview_attachment/static/src/less/sidebar_preview.less @@ -19,15 +19,11 @@ .o_cp_sidebar { .o_sidebar_preview_attachment { - right: -12px; + right: -18px; position: relative; } .open .dropdown-menu > li > a { display: inline-block; } - - .o_sidebar_delete_attachment { - top: 3px; - } } diff --git a/muk_web_preview_attachment/static/src/less/widget_preview.less b/muk_web_preview_attachment/static/src/less/widget_preview.less new file mode 100644 index 0000000..200de37 --- /dev/null +++ b/muk_web_preview_attachment/static/src/less/widget_preview.less @@ -0,0 +1,33 @@ +/********************************************************************************** +* +* Copyright (C) 2017 MuK IT GmbH +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Affero General Public License as +* published by the Free Software Foundation, either version 3 of the +* License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Affero General Public License for more details. +* +* You should have received a copy of the GNU Affero General Public License +* along with this program. If not, see . +* +**********************************************************************************/ + +.o_attachment_preview { + border: 0; + cursor: pointer; + padding: 0; + background: transparent; + -webkit-appearance: none; + opacity: 0.9; + filter: alpha(opacity=90); + + &:hover , &:focus { + opacity: 1; + filter: alpha(opacity=100); + } +} diff --git a/muk_web_preview_attachment/static/src/xml/widget_preview.xml b/muk_web_preview_attachment/static/src/xml/widget_preview.xml new file mode 100644 index 0000000..9b98f37 --- /dev/null +++ b/muk_web_preview_attachment/static/src/xml/widget_preview.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + widget.metadata[file.id] ? file.data.id : false + + + + + diff --git a/muk_web_preview_attachment/template/assets.xml b/muk_web_preview_attachment/template/assets.xml index 4c93461..fab0b43 100644 --- a/muk_web_preview_attachment/template/assets.xml +++ b/muk_web_preview_attachment/template/assets.xml @@ -22,12 +22,14 @@ +