[MERGE] Merged MDI's branch to fix the issue of name_get of ir.actions.todo

bzr revid: pso@tinyerp.com-20120828124750-1kbqgdq0mrc0av2b
This commit is contained in:
pso (OpenERP) 2012-08-28 18:17:50 +05:30
parent 1ebf187ddf
commit 00a4560963
1 changed files with 17 additions and 0 deletions

View File

@ -552,5 +552,22 @@ class res_config_settings(osv.osv_memory):
if action_ids:
return act_window.read(cr, uid, action_ids[0], [], context=context)
return {}
def name_get(self, cr, uid, ids, context=None):
""" Override name_get method to return an appropriate configuration wizard
name, and not the generated name."""
if not len(ids):
return []
# name_get may receive int id instead of an id list
if isinstance(ids, (int, long)):
ids = [ids]
act_window = self.pool.get('ir.actions.act_window')
action_ids = act_window.search(cr, uid, [('res_model', '=', self._name)], context=context)
name = self._name
if action_ids:
name = act_window.read(cr, uid, action_ids[0], ['name'], context=context)['name']
return [(record.id, name) for record in self.browse(cr, uid , ids, context=context)]
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: