diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-03-23 10:31:00 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-03-23 10:31:00 +0100 |
| commit | 845f4ef7d3fdd4c5a6753448fc4a8b487106149f (patch) | |
| tree | 064c30616279e4368e77eef377bed7c9ea6c21e5 /addons/web/controllers | |
| parent | 2a6ff8f8e47874151c45352f31b8206b3fab9456 (diff) | |
| parent | 8a7b845353155d12c7717be476583fdf61e3e22c (diff) | |
[MERGE] forward port branch saas-11.2 up to 8a7b8453531
Diffstat (limited to 'addons/web/controllers')
| -rw-r--r-- | addons/web/controllers/main.py | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index f5ff80cc796..ccf7b932669 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1494,69 +1494,6 @@ class ExcelExport(ExportFormat, http.Controller): fp.close() return data -class Reports(http.Controller): - POLLING_DELAY = 0.25 - TYPES_MAPPING = { - 'doc': 'application/vnd.ms-word', - 'html': 'text/html', - 'odt': 'application/vnd.oasis.opendocument.text', - 'pdf': 'application/pdf', - 'sxw': 'application/vnd.sun.xml.writer', - 'xls': 'application/vnd.ms-excel', - } - - @http.route('/web/report', type='http', auth="user") - @serialize_exception - def index(self, action, token): - action = json.loads(action) - - context = dict(request.context) - context.update(action["context"]) - - report_data = {} - report_ids = context.get("active_ids", None) - if 'report_type' in action: - report_data['report_type'] = action['report_type'] - if 'datas' in action: - if 'ids' in action['datas']: - report_ids = action['datas'].pop('ids') - report_data.update(action['datas']) - - report_id = dispatch_rpc('report', 'report', [ - request.session.db, request.session.uid, request.session.password, - action["report_name"], report_ids, report_data, context]) - - report_struct = None - while True: - report_struct = dispatch_rpc('report', 'report_get', [ - request.session.db, request.session.uid, request.session.password, report_id]) - if report_struct["state"]: - break - - time.sleep(self.POLLING_DELAY) - - report = base64.b64decode(report_struct['result']) - if report_struct.get('code') == 'zlib': - report = zlib.decompress(report) - report_mimetype = self.TYPES_MAPPING.get( - report_struct['format'], 'octet-stream') - file_name = action.get('name', 'report') - if 'name' not in action: - reports = request.env['ir.actions.report'] - reports = reports.search([('report_name', '=', action['report_name'])]) - if reports: - file_name = reports[0].name - else: - file_name = action['report_name'] - file_name = '%s.%s' % (file_name, report_struct['format']) - - return request.make_response(report, - headers=[ - ('Content-Disposition', content_disposition(file_name)), - ('Content-Type', report_mimetype), - ('Content-Length', len(report))], - cookies={'fileToken': token}) - class Apps(http.Controller): @http.route('/apps/<app>', auth='user') def get_app_url(self, req, app): |
