[FIX] ir.model: during creation of custom models, the _auto_init call should also...
authorOlivier Dony <odo@openerp.com>
Tue, 30 Jul 2013 11:46:45 +0000 (13:46 +0200)
committerOlivier Dony <odo@openerp.com>
Tue, 30 Jul 2013 11:46:45 +0000 (13:46 +0200)
The _auto_init call in ir.model.fields creation will not
do it because it happens before the insertion of the model
in the registry. It will only work for later addition of
fields.

bzr revid: odo@openerp.com-20130730114645-185kbupcrbtnv1tf

openerp/addons/base/ir/ir_model.py

index 1328704..0357470 100644 (file)
@@ -195,7 +195,8 @@ class ir_model(osv.osv):
             ctx = dict(context,
                 field_name=vals['name'],
                 field_state='manual',
-                select=vals.get('select_level', '0'))
+                select=vals.get('select_level', '0'),
+                update_custom_fields=True)
             self.pool.get(vals['model'])._auto_init(cr, ctx)
             openerp.modules.registry.RegistryManager.signal_registry_change(cr.dbname)
         return res