ir.model: fix loading of data, for inheriting models

Since a recent commit, non (long, int) values will propagate, so we'd
better not use inherit_id = browse_record(...) as a value in create()'s
dict.

Previously, it did work because we define __int__() so that:
    int(browse_record(...)) == browse_record(...).id

bzr revid: p_christ@hol.gr-20110117084054-8qv5uc4vt4w9aygv
This commit is contained in:
P. Christeas 2011-01-17 10:40:54 +02:00
parent acc5c03dfb
commit c180358e30
1 changed files with 4 additions and 2 deletions

View File

@ -664,8 +664,10 @@ class ir_model_data(osv.osv):
},context=context)
if model_obj._inherits:
for table in model_obj._inherits:
inherit_id = model_obj.browse(cr, uid,
res_id,context=context)[model_obj._inherits[table]]
inherit_id = getattr(model_obj.browse(cr, uid,
res_id,context=context), model_obj._inherits[table])
if isinstance(inherit_id, browse_record): # most likely
inherit_id = inherit_id.id
self.create(cr, uid, {
'name': xml_id + '_' + table.replace('.', '_'),
'model': table,