[FIX] base/ir_model: upon custom field creation, always clear manual fields in registry

The invalidation in registry was done only if the field's model was already in
registry.  This situation is not the case when you create a custom model with a
custom field.
This commit is contained in:
Raphael Collet 2015-03-17 11:40:19 +01:00
parent d117bad18c
commit e182da22f4
1 changed files with 2 additions and 2 deletions

View File

@ -383,13 +383,13 @@ class ir_model_fields(osv.osv):
if vals.get('relation',False) and not self.pool['ir.model'].search(cr, user, [('model','=',vals['relation'])]):
raise except_orm(_('Error'), _("Model %s does not exist!") % vals['relation'])
self.pool.clear_manual_fields()
if vals['model'] in self.pool:
model = self.pool[vals['model']]
if vals['model'].startswith('x_') and vals['name'] == 'x_name':
model._rec_name = 'x_name'
self.pool.clear_manual_fields()
# re-initialize model in registry
model.__init__(self.pool, cr)
self.pool.setup_models(cr, partial=(not self.pool.ready))