Skip to Content
Menu
This question has been flagged
1 Reply
10650 Views

Hi,

In German's Excel Sheets (xls, xlsx) you need to put "," instead of "." as a decimal mark. As a result, csv files also need to look different for Germans to be opened in Excel. The seperator we use to seperate values is ";" instead of "," How do I accomplish this for the Excel Export in OpenERP 7 ?

Regards

Sascha


Im fixing this now by adjusting the neccessary files, so for further reference:

1) First step

addons/web/controllers/main.py

change:

    writer = csv.writer(fp, uoting=csv.QUOTE_ALL)

to:

    csv_internal_sep = config['csv_internal_sep']

    writer = csv.writer(fp, delimiter=csv_internal_sep, quoting=csv.QUOTE_ALL)


2) Second step

server/opener/osv/orm.py

change at the end of __export_row():


def __export_row(self, cr, uid, row, fields, context=None):

[...]

if i == len(f):

     if isinstance(r, browse_record):

          r = self.pool.get(r._table_name).name_get(cr, uid, [r.id], context=context)

          r = r and r[0] and r[0][1] or ''

    data[fpos] = tools.ustr(r or '')


return [data] + lines


to


def __export_row(self, cr, uid, row, fields, context=None):

[...]

    if i == len(f):

        if isinstance(r, browse_record):

            r = self.pool.get(r._table_name).name_get(cr, uid, [r.id], context=context)

            r = r and r[0] and r[0][1] or ''

        data[fpos] = tools.ustr(r or '')

if self.pool.get('res.users').browse(cr, uid, uid).lang == 'de_DE':

        if f[i - 1] in self._columns and self._columns[f[i - 1]]._type == 'float' \

                    or f[i - 1] in self._inherit_fields and self._inherit_fields[f[i - 1]][2]._type == 'float':

            data[fpos] = data[fpos].replace(',', '')

            data[fpos] = data[fpos].replace('.', ',')

return [data] + lines

Hope this helps whoever runs into the same problem.


Avatar
Discard
Best Answer

Try this: 

in your config file put folowing line:
csv_internal_sep = ;

it will set semicolon as default delimiter in csv files for import data, but i belive it will also set semicolon as delimiter fro export data.. as for thousands separator.. try setig it correcty in language settings... should work.. 


hope it helps


 

Avatar
Discard
Author

I already have both settings set this way, but they seem to be completly ignored for CSV / Excel Export

Related Posts Replies Views Activity
2
May 22
31154
0
Mar 19
2685
0
Jan 19
3632
4
Feb 24
10712
0
Jan 18
2778