diff --git a/muk_utils/__init__.py b/muk_utils/__init__.py index c1ac23e..5b5d62d 100644 --- a/muk_utils/__init__.py +++ b/muk_utils/__init__.py @@ -17,6 +17,5 @@ # ################################################################################### -from . import controllers from . import models from . import tools \ No newline at end of file diff --git a/muk_utils/__manifest__.py b/muk_utils/__manifest__.py index bf62846..265f5a3 100644 --- a/muk_utils/__manifest__.py +++ b/muk_utils/__manifest__.py @@ -19,7 +19,7 @@ { "name": "MuK Utils", "summary": """Utility Features""", - "version": '12.0.1.6.17', + "version": '12.0.1.6.18', "category": 'Extra Tools', "license": "AGPL-3", "author": "MuK IT", diff --git a/muk_utils/controllers/__init__.py b/muk_utils/controllers/__init__.py deleted file mode 100644 index 4631769..0000000 --- a/muk_utils/controllers/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -################################################################################### -# -# 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 backend diff --git a/muk_utils/controllers/backend.py b/muk_utils/controllers/backend.py deleted file mode 100644 index d817c4f..0000000 --- a/muk_utils/controllers/backend.py +++ /dev/null @@ -1,50 +0,0 @@ -################################################################################### -# -# 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 json -import base64 -import logging - -from odoo import http -from odoo.http import request - -_logger = logging.getLogger(__name__) - -class BackendController(http.Controller): - - @http.route('/utils/attachment/add', type='http', auth="user", methods=['POST']) - def add_attachment(self, ufile=None, **kw): - content = ufile.read() - attachment = request.env['ir.attachment'].create({ - 'name': "Access Attachment: %s" % ufile.filename, - 'datas': base64.b64encode(content), - 'datas_fname': ufile.filename, - 'type': 'binary', - 'public': False, - }) - attachment.generate_access_token() - base_url = request.env['ir.config_parameter'].sudo().get_param('web.base.url') - result = attachment.read(['name', 'datas_fname', 'mimetype', 'checksum', 'access_token'])[0] - result['url'] = '%s/web/content/%s?access_token=%s' % (base_url, attachment.id, attachment.access_token) - return json.dumps(result) - - @http.route('/utils/attachment/remove', type='http', auth="user", methods=['POST']) - def remove_attachment(self, id, **kw): - return json.dumps(request.env['ir.attachment'].browse(id).unlink()) - \ No newline at end of file