Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
11268 Представления

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.


Аватар
Отменить
Лучший ответ

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


 

Аватар
Отменить
Автор

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

Related Posts Ответы Просмотры Активность
2
мая 22
33798
0
мар. 19
3949
0
янв. 19
4991
4
февр. 24
12208
0
янв. 18
3871