summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorced <>2007-10-19 12:15:51 +0000
committerced <>2007-10-19 12:15:51 +0000
commitcf3a4e503bca3bcd0e545db77f6192775e68a010 (patch)
treeb35247f54558cb6564cdad1cb7131f4d5867e56a /bin
parentaf23179759733dc163d3450d2759d9ea80b08bad (diff)
Add warning if not finding many2many relation
bzr revid: ced-db99f423795c79294f5241bc1c11cf8ed78968d3
Diffstat (limited to 'bin')
-rw-r--r--bin/osv/orm.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/bin/osv/orm.py b/bin/osv/orm.py
index 56fc18f5291..4c37e20e129 100644
--- a/bin/osv/orm.py
+++ b/bin/osv/orm.py
@@ -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)]