Last active
January 11, 2018 09:25
-
-
Save oerp-odoo/59b506ce4372916a3c39fb7d5c9ac930 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@http.route('/web/excel.report/xls', type='http', auth="user") | |
def download_xls_report(self, model, id): | |
"""Handle download for XLS reports.""" | |
# Prepare report wizard | |
Model = request.registry[model] | |
cr, uid, context = request.cr, request.uid, request.context | |
id = int(id) | |
wizard = Model.browse(cr, uid, id, context=context) | |
# Get filename | |
filename = wizard.get_filename() | |
# Download | |
return request.make_response( | |
(wizard.data), | |
headers=[('Content-Disposition', content_disposition(filename)), | |
('Content-Type', 'application/vnd.ms-excel')]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment