[FIX] ir_model_fields: when adding a new custom column to a custom model, set a valid _rec_name to this model (otherwise would require a server restart to reinstanciate the model)

This commit is contained in:
Martin Trigaux 2014-05-15 16:25:51 +02:00
parent 69e2614641
commit 07e4e15f4d
1 changed files with 2 additions and 0 deletions

View File

@ -351,6 +351,8 @@ class ir_model_fields(osv.osv):
raise except_orm(_('Error'), _("Model %s does not exist!") % vals['relation'])
if self.pool.get(vals['model']):
if vals['model'].startswith('x_') and vals['name'] == 'x_name':
self.pool[vals['model']]._rec_name = 'x_name'
self.pool.get(vals['model']).__init__(self.pool, cr)
#Added context to _auto_init for special treatment to custom field for select_level
ctx = dict(context,