diff --git a/openerp/addons/base/ir/ir_model.py b/openerp/addons/base/ir/ir_model.py index c03d6cfaf78..b6bb0c5e227 100644 --- a/openerp/addons/base/ir/ir_model.py +++ b/openerp/addons/base/ir/ir_model.py @@ -933,13 +933,6 @@ class ir_model_data(osv.osv): elif res_id: model_obj.write(cr, uid, [res_id], values, context=context) if xml_id: - self.create(cr, uid, { - 'name': xml_id, - 'model': model, - 'module':module, - 'res_id':res_id, - 'noupdate': noupdate, - },context=context) if model_obj._inherits: for table in model_obj._inherits: inherit_id = model_obj.browse(cr, uid, @@ -951,17 +944,17 @@ class ir_model_data(osv.osv): 'res_id': inherit_id.id, 'noupdate': noupdate, },context=context) + self.create(cr, uid, { + 'name': xml_id, + 'model': model, + 'module':module, + 'res_id':res_id, + 'noupdate': noupdate, + },context=context) else: if mode=='init' or (mode=='update' and xml_id): res_id = model_obj.create(cr, uid, values, context=context) if xml_id: - self.create(cr, uid, { - 'name': xml_id, - 'model': model, - 'module': module, - 'res_id': res_id, - 'noupdate': noupdate - },context=context) if model_obj._inherits: for table in model_obj._inherits: inherit_id = model_obj.browse(cr, uid, @@ -973,6 +966,13 @@ class ir_model_data(osv.osv): 'res_id': inherit_id.id, 'noupdate': noupdate, },context=context) + self.create(cr, uid, { + 'name': xml_id, + 'model': model, + 'module': module, + 'res_id': res_id, + 'noupdate': noupdate + },context=context) if xml_id and res_id: self.loads[(module, xml_id)] = (model, res_id) for table, inherit_field in model_obj._inherits.iteritems(): diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py index dd3a8ca64cf..c6609592e00 100644 --- a/openerp/osv/orm.py +++ b/openerp/osv/orm.py @@ -482,7 +482,7 @@ class browse_record(object): except KeyError, e: import sys exc_info = sys.exc_info() - raise AttributeError, "Got %r while trying to get attribute `%s`." % (e, name), exc_info[2] + raise AttributeError, "Got %r while trying to get attribute %s on a %s record." % (e, name, self._table._name), exc_info[2] def __contains__(self, name): return (name in self._table._columns) or (name in self._table._inherit_fields) or hasattr(self._table, name)