Added a new configuration option: 'csv_internal_sep' (equals ',' by default)

Some old import files used the pipe ('|') as a separator in records. It has
been changed to a comma but this causes problems with old import files when
some records have a comma that is not a separator.

bzr revid: olt@tinyerp.com-20090115101210-czdbqqeptbj8o1so
This commit is contained in:
Olivier Laurent 2009-01-15 11:12:10 +01:00
parent b9e9fca91b
commit f386b602a2
2 changed files with 39 additions and 38 deletions

View File

@ -481,7 +481,7 @@ class orm_template(object):
if line[i]:
if fields_def[field[len(prefix)][:-3]]['type']=='many2many':
res_id = []
for word in line[i].split(','):
for word in line[i].split(config.get('csv_internal_sep')):
if '.' in word:
module, xml_id = word.rsplit('.', 1)
else:
@ -551,7 +551,7 @@ class orm_template(object):
res = []
if line[i]:
relation = fields_def[field[len(prefix)]]['relation']
for word in line[i].split(','):
for word in line[i].split(config.get('csv_internal_sep')):
res2 = self.pool.get(relation).name_search(cr,
uid, word, [], operator='=')
res3 = (res2 and res2[0][0]) or False

View File

@ -60,6 +60,7 @@ class configmanager(object):
'language': None,
'pg_path': None,
'admin_passwd': 'admin',
'csv_internal_sep': ',',
'addons_path': None,
'root_path': None,
'debug_mode': False,