diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-03-22 20:05:14 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-03-22 20:05:14 +0100 |
| commit | cdbee48888a9028ed54abc2c764d2b560e0af099 (patch) | |
| tree | 72dcd7ea458cd6ce14d2e365ee82bea53947dc4a /addons/web/controllers/main.py | |
| parent | 7d86bdca2111e3aeec8d165814b086c43b62998e (diff) | |
| parent | 39d9c362c5b67a6c5a5d589daa13941e21358b1d (diff) | |
[MERGE] forward port branch 11.0 up to 39d9c362c5b
Diffstat (limited to 'addons/web/controllers/main.py')
| -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 8a307e893be..0dccd508186 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): |
