diff options
| author | Fabien Pinckaers <fp@tinyerp.com> | 2008-08-19 15:26:12 +0200 |
|---|---|---|
| committer | Fabien Pinckaers <fp@tinyerp.com> | 2008-08-19 15:26:12 +0200 |
| commit | 02a3ce47f4374908f65e0cd7a7d4433c8ae4ca39 (patch) | |
| tree | 02c75c60444bd2529c88dd31d40956d7dacf1fcc /bin/tools/convert.py | |
| parent | 64f20c2234a2acac54ecb32c1a982411dd4c3f08 (diff) | |
Partial Commit
bzr revid: fp@tinyerp.com-20080819132612-06llazok11knlwr7
Diffstat (limited to 'bin/tools/convert.py')
| -rw-r--r-- | bin/tools/convert.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/bin/tools/convert.py b/bin/tools/convert.py index 626052c060d..1cf3b9b3db9 100644 --- a/bin/tools/convert.py +++ b/bin/tools/convert.py @@ -724,6 +724,10 @@ def convert_csv_import(cr, module, fname, csvcontent, idref=None, mode='init', pool = pooler.get_pool(cr.dbname) + input = StringIO.StringIO(csvcontent) + reader = csv.reader(input, quotechar='"', delimiter=',') + fields = reader.next() + import pickle if config.get('import_partial'): if not os.path.isfile(config.get('import_partial')): @@ -732,10 +736,9 @@ def convert_csv_import(cr, module, fname, csvcontent, idref=None, mode='init', if fname in data: if not data[fname]: return - - input = StringIO.StringIO(csvcontent) - reader = csv.reader(input, quotechar='"', delimiter=',') - fields = reader.next() + else: + for i in range(data[fname]): + reader.next() if not (mode == 'init' or 'id' in fields): return @@ -746,7 +749,7 @@ def convert_csv_import(cr, module, fname, csvcontent, idref=None, mode='init', if (not line) or not reduce(lambda x,y: x or y, line) : continue datas.append( map(lambda x:x.decode('utf8').encode('utf8'), line)) - pool.get(model).import_data(cr, uid, fields, datas,mode, module,noupdate) + pool.get(model).import_data(cr, uid, fields, datas,mode, module,noupdate,filename=fname) if config.get('import_partial'): data = pickle.load(file(config.get('import_partial'))) data[fname] = 0 |
