diff --git a/openerp/addons/base/module/module_data.xml b/openerp/addons/base/module/module_data.xml index ecd5226ad89..15cbded05cd 100644 --- a/openerp/addons/base/module/module_data.xml +++ b/openerp/addons/base/module/module_data.xml @@ -134,7 +134,7 @@ - + diff --git a/openerp/addons/base/res/res_config.py b/openerp/addons/base/res/res_config.py index 3f4a052a36b..d6b42e970bf 100644 --- a/openerp/addons/base/res/res_config.py +++ b/openerp/addons/base/res/res_config.py @@ -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 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: diff --git a/openerp/addons/base/res/res_users.py b/openerp/addons/base/res/res_users.py index 5e1ea88f5ac..1f0d612468f 100644 --- a/openerp/addons/base/res/res_users.py +++ b/openerp/addons/base/res/res_users.py @@ -52,7 +52,19 @@ class groups(osv.osv): else: res[g.id] = g.name return res - + + def _search_group(self, cr, uid, obj, name, args, context=None): + operand = args[0][2] + operator = args[0][1] + values = operand.split('/') + group_name = values[0] + where = [('name', operator, group_name)] + if len(values) > 1: + application_name = values[0] + group_name = values[1] + where = ['|',('category_id.name', operator, application_name)] + where + return where + _columns = { 'name': fields.char('Name', size=64, required=True, translate=True), 'users': fields.many2many('res.users', 'res_groups_users_rel', 'gid', 'uid', 'Users'), @@ -62,7 +74,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', fnct_search=_search_group), } _sql_constraints = [ @@ -806,7 +818,7 @@ class users_view(osv.osv): for app, kind, gs in self.pool.get('res.groups').get_groups_by_application(cr, uid, context): if kind == 'selection': # selection group field - tips = ['%s: %s' % (g.name, g.comment or '') for g in gs] + tips = ['%s: %s' % (g.name, g.comment) for g in gs if g.comment] res[name_selection_groups(map(int, gs))] = { 'type': 'selection', 'string': app and app.name or _('Other'),