|
|
@ -1,8 +1,8 @@ |
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
############################################################################## |
|
|
|
# |
|
|
|
# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>) |
|
|
|
# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>) |
|
|
|
# Copyright (C) 2012-2013 Agile Business Group sagl (<http://www.agilebg.com>) |
|
|
|
# |
|
|
|
# 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 |
|
|
@ -23,27 +23,25 @@ try: |
|
|
|
except ImportError: |
|
|
|
import simplejson as json |
|
|
|
|
|
|
|
import web.http as openerpweb |
|
|
|
|
|
|
|
from web.controllers.main import ExcelExport |
|
|
|
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) |
|
|
|
|
|
|
|
@openerpweb.httprequest |
|
|
|
def index(self, req, data, token): |
|
|
|
@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( |
|
|
|
return request.make_response( |
|
|
|
self.from_data(columns_headers, rows), |
|
|
|
headers=[ |
|
|
|
('Content-Disposition', 'attachment; filename="%s"' |