Openerp 在Odoo中一次更改所有用户的访问权限

Openerp 在Odoo中一次更改所有用户的访问权限,openerp,Openerp,现在我的系统中有300多个用户。默认情况下,对于所有人,人力资源:员工在那里。现在,我想删除所有这些的访问权限。 我试图从数据库访问,但没有用 我该怎么做呢?试试这个 from openerp import SUPERUSER_ID @api.multi def update_all_users_hr_employee_access(self): category_id=self.pool.get('ir.module.category').search(

现在我的系统中有300多个用户。默认情况下,对于所有人,人力资源:员工在那里。现在,我想删除所有这些的访问权限。 我试图从数据库访问,但没有用

我该怎么做呢?

试试这个

from openerp import SUPERUSER_ID
@api.multi    
    def update_all_users_hr_employee_access(self):    
        category_id=self.pool.get('ir.module.category').search(cr,uid,[('name','=','Human Resources')],context=context)
        group_ids=self.pool.get('res.groups').search(cr,uid,[('category_id','=',category_id[0]),('name','=','Employee')],context=context)
        group_obj = self.pool.get('res.groups').browse(cr, uid,group_ids[0],context=context)
        write_op = [(3, user.id) for user in group_obj.users if user.id!=SUPERUSER_ID]
        group_obj.write(cr, uid, [group_obj.id], {'users': write_op}, context=context)
        return True