在 Odoo 中一次更改所有用户的访问权限
Change Access Rights to all the User at a Time in Odoo
现在我的系统中有 300 多个用户。对于所有这些,默认情况下 Human Resources : Employee 在那里。现在,我想删除对所有这些的访问权限。
我尝试从数据库访问,但没有用。
我该怎么做?
试试这个,
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
现在我的系统中有 300 多个用户。对于所有这些,默认情况下 Human Resources : Employee 在那里。现在,我想删除对所有这些的访问权限。 我尝试从数据库访问,但没有用。
我该怎么做?
试试这个,
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