You can check it by administrator or not by this function
def check_user(self, uid=None):
if uid is None:
uid = request.uid
is_admin = request.registry['res.users']._is_admin(request.cr, uid, [uid])
if not is_admin:
raise openerp.exceptions.AccessError("Only administrators can upload a module")
and call this function with arguments such as:
uid = request.session.authenticate(request.db, login, password)
self.check_user(uid)
and you can use this function in your onchange
@api.v7
def check_acl(self, cr, uid, ids, my_field, context=None):
if self.check_user(uid):
return {'value': {'in_group_1': True}}
source
share