Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
11293 Vizualizări

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.


Imagine profil
Abandonează
Cel mai bun răspuns

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


 

Imagine profil
Abandonează
Autor

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

Related Posts Răspunsuri Vizualizări Activitate
2
mai 22
33834
0
mar. 19
3994
0
ian. 19
5034
4
feb. 24
12241
0
ian. 18
3891