Hello everybody.
I am trying to obtain the groups which the logged in user belong to; after this what I´m trying to achieve is to compare if the logged in user belongs to a certain group in order to create a boolean flag which later on, I will use un my xml view to conditioned a page to be invisible or not.
I am using odoo 8 and the code I have until now is the following:
'make_invisible':fields.function(get_user, string="Is Invisible")
def get_user(self, cr, uid, ids, context=None):
_logger.debug("This is GET_USER method ")
result = {}
user = self.pool.get('res.users').browse(cr, uid, user_id, context=context)
if user.has_group('hr_employee.NewGroup'):
_logger.debug(":::True:::")
return False
else:
_logger.debug(":::False:::")
return False
Another question is: with the "has_group" should I use the group name that I wrote through the GUI or the XML ID??
Currently I am getting:
TypeError: get_user() takes at most 5 arguments (7 given)
Define your function like this
` def get_user (self, cr, uid, ids, name, arg, context=None):
//statement