[FIX] base: wrong model change check
authorMartin Trigaux <mat@openerp.com>
Thu, 21 Aug 2014 12:30:10 +0000 (14:30 +0200)
committerMartin Trigaux <mat@openerp.com>
Thu, 21 Aug 2014 12:30:10 +0000 (14:30 +0200)
Comparing an id and a browse record will always fail so the exception would have always been raised when changing a model (e.g. updating a module with custom fields).

openerp/addons/base/ir/ir_model.py

index 8796f89..4fe4fc0 100644 (file)
@@ -440,7 +440,7 @@ class ir_model_fields(osv.osv):
                     column_rename = (obj, (obj._table, item.name, vals['name']))
                     final_name = vals['name']
 
-                if 'model_id' in vals and vals['model_id'] != item.model_id:
+                if 'model_id' in vals and vals['model_id'] != item.model_id.id:
                     raise except_orm(_("Error!"), _("Changing the model of a field is forbidden!"))
 
                 if 'ttype' in vals and vals['ttype'] != item.ttype: