diff --git a/web_export_view/__init__.py b/web_export_view/__init__.py index 09691964..950efdaa 100644 --- a/web_export_view/__init__.py +++ b/web_export_view/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # Copyright (C) 2012 Agile Business Group sagl () # Copyright (C) 2012 Domsense srl () # @@ -18,4 +18,4 @@ # along with this program. If not, see . # ############################################################################## -import controllers +import controllers \ No newline at end of file diff --git a/web_export_view/__openerp__.py b/web_export_view/__openerp__.py index 37ab5ede..e2c6a636 100644 --- a/web_export_view/__openerp__.py +++ b/web_export_view/__openerp__.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- -# ############################################################################# +############################################################################## # -# Copyright (C) 2012 Domsense srl () -# Copyright (C) 2012-2013 Agile Business Group sagl -# () +# Copyright (C) 2012 Agile Business Group sagl () +# Copyright (C) 2012 Domsense srl () # # 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 @@ -22,7 +21,7 @@ { 'name': 'Export Current View', - 'version': '1.1', + 'version': '1.2', 'category': 'Web', 'description': """ WEB EXPORT VIEW @@ -50,11 +49,11 @@ the same data of the tree view you are looking at, headers included. 'depends': [ 'web', ], - 'js': [ - 'static/src/js/web_advanced_export.js', + 'data': [ + 'view/web_export_view.xml', ], 'qweb': [ - 'static/src/xml/web_advanced_export.xml', + 'static/src/xml/web_export_view_template.xml', ], 'installable': True, 'auto_install': False, diff --git a/web_export_view/controllers/__init__.py b/web_export_view/controllers/__init__.py new file mode 100644 index 00000000..994ad368 --- /dev/null +++ b/web_export_view/controllers/__init__.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2012 Agile Business Group sagl () +# Copyright (C) 2012 Domsense srl () +# +# 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 controllers diff --git a/web_export_view/controllers.py b/web_export_view/controllers/controllers.py similarity index 73% rename from web_export_view/controllers.py rename to web_export_view/controllers/controllers.py index 82968ffe..acdcf2a8 100644 --- a/web_export_view/controllers.py +++ b/web_export_view/controllers/controllers.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# ############################################################################# +############################################################################## # # Copyright (C) 2012 Agile Business Group sagl () # Copyright (C) 2012 Domsense srl () @@ -23,33 +23,30 @@ try: except ImportError: import simplejson as json -import openerp import openerp.http as http from openerp.http import request from openerp.addons.web.controllers.main import ExcelExport class ExcelExportView(ExcelExport): - _cp_path = '/web/export/xls_view' - def __getattribute__(self, name): if name == 'fmt': raise AttributeError() return super(ExcelExportView, self).__getattribute__(name) - @http.route('/web/export/xls_view', type='json', auth='user') + @http.route('/web/export/xls_view', type='http', auth='user') def index(self, data, token): data = json.loads(data) model = data.get('model', []) columns_headers = data.get('headers', []) rows = data.get('rows', []) - # - # return req.make_response( - # self.from_data(columns_headers, rows), - # headers=[ - # ('Content-Disposition', 'attachment; filename="%s"' - # % self.filename(model)), - # ('Content-Type', self.content_type) - # ], - # cookies={'fileToken': token} - # ) + + return request.make_response( + self.from_data(columns_headers, rows), + headers=[ + ('Content-Disposition', 'attachment; filename="%s"' + % self.filename(model)), + ('Content-Type', self.content_type) + ], + cookies={'fileToken': token} + ) diff --git a/web_export_view/static/src/js/web_advanced_export.js b/web_export_view/static/src/js/web_export_view.js similarity index 98% rename from web_export_view/static/src/js/web_advanced_export.js rename to web_export_view/static/src/js/web_export_view.js index 4b096b53..74c86d4d 100644 --- a/web_export_view/static/src/js/web_advanced_export.js +++ b/web_export_view/static/src/js/web_export_view.js @@ -18,7 +18,6 @@ // along with this program. If not, see . // //############################################################################# - openerp.web_export_view = function (instance) { debugger; @@ -94,21 +93,20 @@ openerp.web_export_view = function (instance) { }); export_rows.push(export_row); } - ; } }); $.blockUI(); + debugger; view.session.get_file({ url: '/web/export/xls_view', data: {data: JSON.stringify({ model: view.model, headers: export_columns_names, - rows: export_rows, + rows: export_rows })}, complete: $.unblockUI }); - }, - + } }); }; diff --git a/web_export_view/static/src/xml/web_advanced_export.xml b/web_export_view/static/src/xml/web_export_view_template.xml similarity index 92% rename from web_export_view/static/src/xml/web_advanced_export.xml rename to web_export_view/static/src/xml/web_export_view_template.xml index e5c48f5f..fbd855d9 100644 --- a/web_export_view/static/src/xml/web_advanced_export.xml +++ b/web_export_view/static/src/xml/web_export_view_template.xml @@ -1,6 +1,5 @@ - +
diff --git a/web_export_view/view/web_export_view.xml b/web_export_view/view/web_export_view.xml new file mode 100644 index 00000000..502070f1 --- /dev/null +++ b/web_export_view/view/web_export_view.xml @@ -0,0 +1,11 @@ + + + + + + +