[FIX] share: correct groups names in error messages

bzr revid: odo@openerp.com-20120615153607-8mgu0119g5xx1w4g
This commit is contained in:
Olivier Dony 2012-06-15 17:36:07 +02:00
parent 0a80d35a66
commit e33611033f
1 changed files with 9 additions and 9 deletions

View File

@ -2,7 +2,7 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2011 OpenERP S.A. (<http://www.openerp.com>).
# Copyright (C) 2010-2012 OpenERP S.A. (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@ -18,9 +18,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import fields, osv
from openerp.osv import osv
class ir_model_access(osv.osv):
class ir_model_access(osv.Model):
_inherit = 'ir.model.access'
# overload group_names_with_access() to avoid returning sharing groups
@ -32,17 +32,17 @@ class ir_model_access(osv.osv):
"""
assert access_mode in ['read','write','create','unlink'], 'Invalid access mode: %s' % access_mode
cr.execute('''SELECT
g.name
c.name, g.name
FROM
ir_model_access a
JOIN ir_model m ON (a.model_id=m.id)
ir_model_access a
JOIN ir_model m ON (a.model_id=m.id)
JOIN res_groups g ON (a.group_id=g.id)
LEFT JOIN ir_module_category c ON (c.id=g.category_id)
WHERE
m.model=%s AND
(g.share IS NULL or g.share IS false) AND
a.perm_''' + access_mode, (model_name,))
return [x[0] for x in cr.fetchall()]
ir_model_access()
return [('%s/%s' % x) if x[0] else x[1] for x in cr.fetchall()]
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: