[FIX] Export creates xml id based on wrong table name

lp bug: https://launchpad.net/bugs/1194893 fixed

bzr revid: stefan@therp.nl-20130626135842-sdbvopuen0s7liv9
This commit is contained in:
Stefan Rijnhart 2013-06-26 15:58:42 +02:00
parent 107df4be73
commit 126b49075d
1 changed files with 3 additions and 3 deletions

View File

@ -1106,7 +1106,7 @@ class BaseModel(object):
def _get_xml_id(self, cr, uid, r):
model_data = self.pool.get('ir.model.data')
data_ids = model_data.search(cr, uid, [('model', '=', r._table_name), ('res_id', '=', r['id'])])
data_ids = model_data.search(cr, uid, [('model', '=', r._model._table), ('res_id', '=', r['id'])])
if len(data_ids):
d = model_data.read(cr, uid, data_ids, ['name', 'module'])[0]
if d['module']:
@ -1116,13 +1116,13 @@ class BaseModel(object):
else:
postfix = 0
while True:
n = self._table+'_'+str(r['id']) + (postfix and ('_'+str(postfix)) or '' )
n = r._model._table+'_'+str(r['id']) + (postfix and ('_'+str(postfix)) or '' )
if not model_data.search(cr, uid, [('name', '=', n)]):
break
postfix += 1
model_data.create(cr, SUPERUSER_ID, {
'name': n,
'model': self._name,
'model': r._model._name,
'res_id': r['id'],
'module': '__export__',
})