From a85d1168725feda5b8ebfa04af028c8c5be1cdec Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 1 Apr 2014 12:07:52 +0200 Subject: [PATCH] [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 --- addons/web/controllers/main.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 21e27a63d08..8e52cb64717 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -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()