[FIX] tools: In convert, return false if record is not found

bzr revid: hmo@tinyerp.com-20100208135003-6fv2rcxedcv9wuyh
This commit is contained in:
Harry (Open ERP) 2010-02-08 19:20:03 +05:30
parent f18ed41f4f
commit 8898d430e2
1 changed files with 4 additions and 1 deletions

View File

@ -740,7 +740,10 @@ form: module.record_id""" % (xml_id,)
if '.' in id_str:
mod,id_str = id_str.split('.')
result = self.pool.get('ir.model.data')._get_id(cr, self.uid, mod, id_str)
return int(self.pool.get('ir.model.data').read(cr, self.uid, [result], ['res_id'])[0]['res_id'])
res = self.pool.get('ir.model.data').read(cr, self.uid, [result], ['res_id'])
if res and res[0] and res[0]['res_id']:
return int(res[0]['res_id'])
return False
def parse(self, de):
if not de.tag in ['terp', 'openerp']: