[FIX] res.user: code cleanup after merging previous patches
bzr revid: odo@openerp.com-20101124164105-xsd2nkit09g29gjl
This commit is contained in:
parent
276a54b0af
commit
c34d2ae6d4
|
@ -524,20 +524,15 @@ class groups2(osv.osv): ##FIXME: Is there a reason to inherit this object ?
|
||||||
for record in self.read(cr, uid, ids, ['users'], context=context):
|
for record in self.read(cr, uid, ids, ['users'], context=context):
|
||||||
if record['users']:
|
if record['users']:
|
||||||
group_users.extend(record['users'])
|
group_users.extend(record['users'])
|
||||||
|
|
||||||
if group_users:
|
if group_users:
|
||||||
group_names = []
|
user_names = [user.name for user in self.pool.get('res.users').browse(cr, uid, group_users, context=context)]
|
||||||
try:
|
if len(user_names) >= 5:
|
||||||
for rec in self.pool.get('res.users').read(cr, uid, group_users, ['name'], context=context):
|
user_names = user_names[:5]
|
||||||
group_names.append(rec['name'])
|
user_names += '...'
|
||||||
if len(group_names) >=5:
|
|
||||||
group_names = group_names[:5]
|
|
||||||
group_names += '...'
|
|
||||||
except Exception:
|
|
||||||
raise osv.except_osv(_('Warning !'), _('Make sure you have no users linked with the group(s)!'))
|
|
||||||
raise osv.except_osv(_('Warning !'),
|
raise osv.except_osv(_('Warning !'),
|
||||||
_('Group(s) cannot be deleted, because user(s) %s participate in them!') % \
|
_('Group(s) cannot be deleted, because some user(s) still belong to them: %s !') % \
|
||||||
', '.join(group_names))
|
', '.join(user_names))
|
||||||
return super(groups2, self).unlink(cr, uid, ids, context=context)
|
return super(groups2, self).unlink(cr, uid, ids, context=context)
|
||||||
|
|
||||||
groups2()
|
groups2()
|
||||||
|
|
Loading…
Reference in New Issue