Add warning if not finding many2many relation

bzr revid: ced-db99f423795c79294f5241bc1c11cf8ed78968d3
This commit is contained in:
ced 2007-10-19 12:15:51 +00:00
parent af23179759
commit cf3a4e503b
1 changed files with 5 additions and 3 deletions

View File

@ -674,9 +674,8 @@ class orm(object):
relation = fields_def[field[len(prefix)]]['relation']
res2 = self.pool.get(relation).name_search(cr, uid, line[i], [],operator='=')
res = (res2 and res2[0][0]) or False
if not res and line[i]:
warning += ('Relation not found: '+line[i]+' on '+relation + ' !\n')
if not res:
warning += ('Relation not found: '+line[i]+' on '+relation + ' !\n')
logger.notifyChannel("import",netsvc.LOG_WARNING,'Relation not found: '+line[i]+' on '+relation + ' !\n')
elif fields_def[field[len(prefix)]]['type']=='many2many':
res = []
@ -685,7 +684,10 @@ class orm(object):
for word in line[i].split(','):
res2 = self.pool.get(relation).name_search(cr, uid, word, [],operator='=')
res3 = (res2 and res2[0][0]) or False
if res3:
if not res3:
warning += ('Relation not found: '+line[i]+' on '+relation + ' !\n')
logger.notifyChannel("import",netsvc.LOG_WARNING,'Relation not found: '+line[i]+' on '+relation + ' !\n')
else:
res.append(res3)
if len(res):
res= [(6,0,res)]