[IMP]Improved base module as per requirement.

bzr revid: hsa@tinyerp.com-20120828064111-msyv13aa07az17zo
This commit is contained in:
Hardik
2012-08-28 12:11:11 +05:30
parent 1ebf187ddf
commit 8c4ce402d1
2 changed files with 20 additions and 3 deletions
+17
View File
@@ -553,4 +553,21 @@ class res_config_settings(osv.osv_memory):
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:
+3 -3
View File
@@ -51,7 +51,7 @@ class groups(osv.osv):
else:
res[g.id] = g.name
return res
_columns = {
'name': fields.char('Name', size=64, required=True, translate=True),
'users': fields.many2many('res.users', 'res_groups_users_rel', 'gid', 'uid', 'Users'),
@@ -61,7 +61,7 @@ class groups(osv.osv):
'menu_access': fields.many2many('ir.ui.menu', 'ir_ui_menu_group_rel', 'gid', 'menu_id', 'Access Menu'),
'comment' : fields.text('Comment', size=250, translate=True),
'category_id': fields.many2one('ir.module.category', 'Application', select=True),
'full_name': fields.function(_get_full_name, type='char', string='Group Name'),
'full_name': fields.function(_get_full_name, type='char', string='Group Name', store=True),
}
_sql_constraints = [
@@ -815,7 +815,7 @@ class users_view(osv.osv):
'type': 'selection',
'string': app and app.name or _('Other'),
'selection': [(False, '')] + [(g.id, g.name) for g in gs],
'help': '\n'.join(tips),
'help': g.comment,
}
else:
# boolean group fields