Browse Source

[FIX] lang by default en_US and replace decimal_point in cell value CHECK: compile regexp is needed in 47 line?

pull/2/head
Cristian Salamea 12 years ago
parent
commit
1a78c9f7ec
  1. 4
      web_export_view/controllers.py

4
web_export_view/controllers.py

@ -50,7 +50,7 @@ class ExcelExportView(ExcelExport):
if isinstance(cell_value, basestring): if isinstance(cell_value, basestring):
cell_value = re.sub("\r", " ", cell_value) cell_value = re.sub("\r", " ", cell_value)
if re.match(m, cell_value): if re.match(m, cell_value):
cell_value = float(cell_value.replace(',',''))
cell_value = float(cell_value.replace(separators['thousands_sep'],'')replace(separators['decimal_point'],'.'))
style = xlwt.easyxf(num_format_str='#,##0.00') style = xlwt.easyxf(num_format_str='#,##0.00')
if cell_value is False: cell_value = None if cell_value is False: cell_value = None
worksheet.write(row_index + 1, cell_index, cell_value, style) worksheet.write(row_index + 1, cell_index, cell_value, style)
@ -70,7 +70,7 @@ class ExcelExportView(ExcelExport):
rows = data.get('rows',[]) rows = data.get('rows',[])
context = req.session.eval_context(req.context) context = req.session.eval_context(req.context)
lang = context.get('lang')
lang = context.get('lang', 'en_US')
Model = req.session.model('res.lang') Model = req.session.model('res.lang')
ids = Model.search([['code','=',lang]]) ids = Model.search([['code','=',lang]])
record = Model.read(ids, ['decimal_point','thousands_sep']) record = Model.read(ids, ['decimal_point','thousands_sep'])

Loading…
Cancel
Save