[FIX] Problem with exports that make them crash

lp bug: https://launchpad.net/bugs/1205238 fixed

bzr revid: nicolas.vanhoren@openerp.com-20130726084640-lz11kdlsk27mrjec
This commit is contained in:
niv-openerp 2013-07-26 10:46:40 +02:00
parent 3cfdf52710
commit 6e6108e9b6
1 changed files with 4 additions and 7 deletions

View File

@ -1407,7 +1407,10 @@ class Export(http.Controller):
:returns: for each export format, a pair of identifier and printable name
:rtype: [(str, str)]
"""
return ["CSV", "Excel"]
return [
{'tag': 'csv', 'label': 'CSV'},
{'tag': 'xls', 'label': 'Excel', 'error': None if xlwt else "XLWT required"},
]
def fields_get(self, model):
Model = request.session.model(model)
@ -1583,7 +1586,6 @@ class ExportFormat(object):
cookies={'fileToken': token})
class CSVExport(ExportFormat, http.Controller):
fmt = {'tag': 'csv', 'label': 'CSV'}
@http.route('/web/export/csv', type='http', auth="user")
def index(self, data, token):
@ -1621,11 +1623,6 @@ class CSVExport(ExportFormat, http.Controller):
return data
class ExcelExport(ExportFormat, http.Controller):
fmt = {
'tag': 'xls',
'label': 'Excel',
'error': None if xlwt else "XLWT required"
}
@http.route('/web/export/xls', type='http', auth="user")
def index(self, data, token):