From 9a1697a5e5086301e2f9f6ffaceaaa2364095b74 Mon Sep 17 00:00:00 2001 From: Mathias Markl Date: Wed, 23 May 2018 01:29:52 +0200 Subject: [PATCH] 1.1.0 --- muk_web_export_attachment/__init__.py | 5 +- muk_web_export_attachment/__manifest__.py | 3 +- .../controllers/__init__.py | 20 ++++++ muk_web_export_attachment/controllers/main.py | 34 +++++++++ muk_web_export_attachment/doc/changelog.rst | 5 ++ .../static/src/js/sidebar_export.js | 15 +++- .../static/src/less/sidebar_export.less | 3 +- muk_web_export_attachment/views/convert.xml | 40 +++++++++++ muk_web_export_attachment/wizards/__init__.py | 20 ++++++ muk_web_export_attachment/wizards/convert.py | 70 +++++++++++++++++++ 10 files changed, 208 insertions(+), 7 deletions(-) create mode 100644 muk_web_export_attachment/controllers/__init__.py create mode 100644 muk_web_export_attachment/controllers/main.py create mode 100644 muk_web_export_attachment/views/convert.xml create mode 100644 muk_web_export_attachment/wizards/__init__.py create mode 100644 muk_web_export_attachment/wizards/convert.py diff --git a/muk_web_export_attachment/__init__.py b/muk_web_export_attachment/__init__.py index fd42c44..5e1b868 100644 --- a/muk_web_export_attachment/__init__.py +++ b/muk_web_export_attachment/__init__.py @@ -15,4 +15,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # -################################################################################### \ No newline at end of file +################################################################################### + +from . import controllers +from . import wizards \ No newline at end of file diff --git a/muk_web_export_attachment/__manifest__.py b/muk_web_export_attachment/__manifest__.py index 7565512..5a00029 100644 --- a/muk_web_export_attachment/__manifest__.py +++ b/muk_web_export_attachment/__manifest__.py @@ -20,7 +20,7 @@ { "name": "MuK Export Attachment", "summary": """Export Odoo Attachments""", - "version": "11.0.1.0.0", + "version": "11.0.1.1 .0", "category": "Extra Tools", "license": "AGPL-3", "website": "http://www.mukit.at", @@ -35,6 +35,7 @@ ], "data": [ "template/assets.xml", + "views/convert.xml", ], "qweb": [ "static/src/xml/*.xml", diff --git a/muk_web_export_attachment/controllers/__init__.py b/muk_web_export_attachment/controllers/__init__.py new file mode 100644 index 0000000..4b71c01 --- /dev/null +++ b/muk_web_export_attachment/controllers/__init__.py @@ -0,0 +1,20 @@ +################################################################################### +# +# 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 . +# +################################################################################### + +from . import main \ No newline at end of file diff --git a/muk_web_export_attachment/controllers/main.py b/muk_web_export_attachment/controllers/main.py new file mode 100644 index 0000000..51703f5 --- /dev/null +++ b/muk_web_export_attachment/controllers/main.py @@ -0,0 +1,34 @@ +################################################################################### +# +# 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 . +# +################################################################################### + +import os +import logging + +from odoo import http +from odoo.http import request + +from odoo.addons.muk_converter.tools import converter + +_logger = logging.getLogger(__name__) + +class ExportController(http.Controller): + + @http.route('/web/attachment/export_action', type='json', auth="user") + def export_action(self, **kw): + return request.env.ref("muk_web_export_attachment.view_converter_export_form").id \ No newline at end of file diff --git a/muk_web_export_attachment/doc/changelog.rst b/muk_web_export_attachment/doc/changelog.rst index 9ee2b48..f4ce83a 100644 --- a/muk_web_export_attachment/doc/changelog.rst +++ b/muk_web_export_attachment/doc/changelog.rst @@ -1,3 +1,8 @@ +`1.1.0` +------- + +- Added "Save as Attachment" Button + `1.0.0` ------- diff --git a/muk_web_export_attachment/static/src/js/sidebar_export.js b/muk_web_export_attachment/static/src/js/sidebar_export.js index b449a1e..cbabbca 100644 --- a/muk_web_export_attachment/static/src/js/sidebar_export.js +++ b/muk_web_export_attachment/static/src/js/sidebar_export.js @@ -30,7 +30,13 @@ var _t = core._t; Sidebar.include({ willStart: function() { var self = this; - var export_formats = this._rpc({ + var export_action = this._rpc({ + route: '/web/attachment/export_action', + }).then(function (result) { + console.log(result); + self.export_action = result; + }); + var export_formats = this._rpc({ route: '/web/export_formats', }).then(function (result) { self.export_formats = result; @@ -62,8 +68,7 @@ Sidebar.include({ .click(this._on_attachment_export.bind(this)); }, _on_attachment_export: function(e) { - e.preventDefault(); - e.stopPropagation(); + var self = this; var $target = $(e.currentTarget); this.do_action({ 'type': 'ir.actions.act_window', @@ -74,11 +79,15 @@ Sidebar.include({ 'view_mode': 'form', 'target': 'new', 'context': { + 'default_res_id': self.env.activeIds[0], + 'default_res_model': self.env.model, 'default_type': "url", 'default_input_url': $target.data("url"), 'default_input_name': $target.data("name"), }, }); + e.preventDefault(); + e.stopPropagation(); } }); diff --git a/muk_web_export_attachment/static/src/less/sidebar_export.less b/muk_web_export_attachment/static/src/less/sidebar_export.less index fcacbcf..2e1b4f0 100644 --- a/muk_web_export_attachment/static/src/less/sidebar_export.less +++ b/muk_web_export_attachment/static/src/less/sidebar_export.less @@ -19,8 +19,7 @@ .o_cp_sidebar { .o_sidebar_export_attachment { - right: -15px; - top: 2px; + right: -18px; position: relative; font-size: 15px; } diff --git a/muk_web_export_attachment/views/convert.xml b/muk_web_export_attachment/views/convert.xml new file mode 100644 index 0000000..1687ce2 --- /dev/null +++ b/muk_web_export_attachment/views/convert.xml @@ -0,0 +1,40 @@ + + + + + + + + muk_converter_convert.form + muk_converter.convert + primary + + + + + + + + +