added noupdate=1 if csv is in init_xml

bzr revid: hda@tinyerp.com-20100303072109-qoi1h70ohfsjq96h
This commit is contained in:
HDA (OpenERP) 2010-03-03 12:51:09 +05:30
parent 33749177de
commit bca733707d
3 changed files with 5 additions and 4 deletions

View File

@ -634,7 +634,10 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, **kwargs):
name, ext = os.path.splitext(filename)
fp = tools.file_open(opj(m, filename))
if ext == '.csv':
tools.convert_csv_import(cr, m, os.path.basename(filename), fp.read(), idref, mode=mode)
noupdate=False
if kind == 'init':
noupdate=True
tools.convert_csv_import(cr, m, os.path.basename(filename), fp.read(), idref, mode=mode, noupdate=noupdate)
elif ext == '.sql':
queries = fp.read().split(';')
for query in queries:

View File

@ -778,7 +778,6 @@ class related(function):
res[data.id] = t_data.id
else:
res[data.id] = t_data
if self._type=='many2one':
ids = filter(None, res.values())
if ids:
@ -790,7 +789,6 @@ class related(function):
for r in res:
if res[r]:
res[r] = [x.id for x in res[r]]
return res
def __init__(self, *arg, **args):

View File

@ -838,7 +838,7 @@ def convert_csv_import(cr, module, fname, csvcontent, idref=None, mode='init',
except:
logger = netsvc.Logger()
logger.notifyChannel("init", netsvc.LOG_ERROR, "Cannot import the line: %s" % line)
pool.get(model).import_data(cr, uid, fields, datas,mode, module,noupdate,filename=fname_partial)
pool.get(model).import_data(cr, uid, fields, datas,mode, module, noupdate, filename=fname_partial)
if config.get('import_partial'):
data = pickle.load(file(config.get('import_partial')))
data[fname_partial] = 0