[FIX] default is False, style format is different than DEFAULT_SERVER_DATE{TIME}_FORMAT, datetime is instance of date

bzr revid: mat@openerp.com-20140401100752-twixfgj2gmggy922
This commit is contained in:
Martin Trigaux 2014-04-01 12:07:52 +02:00
parent 6243d18852
commit a85d116872
1 changed files with 5 additions and 5 deletions

View File

@ -1679,7 +1679,7 @@ class Export(http.Controller):
for k, v in self.fields_info(model, export_fields).iteritems())
class ExportFormat(object):
raw_data = True
raw_data = False
@property
def content_type(self):
@ -1790,18 +1790,18 @@ class ExcelExport(ExportFormat, http.Controller):
worksheet.col(i).width = 8000 # around 220 pixels
base_style = xlwt.easyxf('align: wrap yes')
date_style = xlwt.easyxf('align: wrap yes', num_format_str=tools.DEFAULT_SERVER_DATE_FORMAT)
datetime_style = xlwt.easyxf('align: wrap yes', num_format_str=tools.DEFAULT_SERVER_DATETIME_FORMAT)
date_style = xlwt.easyxf('align: wrap yes', num_format_str='YYYY-MM-DD')
datetime_style = xlwt.easyxf('align: wrap yes', num_format_str='YYYY-MM-DD HH:mm:SS')
for row_index, row in enumerate(rows):
for cell_index, cell_value in enumerate(row):
cell_style = base_style
if isinstance(cell_value, basestring):
cell_value = re.sub("\r", " ", cell_value)
elif isinstance(cell_value, datetime.date):
cell_style = date_style
elif isinstance(cell_value, datetime.datetime):
cell_style = datetime_style
elif isinstance(cell_value, datetime.date):
cell_style = date_style
worksheet.write(row_index + 1, cell_index, cell_value, cell_style)
fp = StringIO()