Skip to Content
Menu
This question has been flagged
1 Reply
5618 Views

Hello, 

I get the following error when i want to create new user :

You cannot create a new user from here.
To create new user please go to configuration panel.

I have created a new class which inherit to class user. It contains override creation function.

ef create(self, vals):

# Check email if exist
exis_email_id = self.env['res.users'].search([('email', '=', vals['email'].lower())])


if exis_email_id:
# raise osv.except_osv(('Invalid Action!'), ('Email already exist.'))
raise osv.except_osv(('Invalid Action!'), ('Email already exist.'))

else:

res = super(User, self).create(vals)
user_group_admin = self.env.ref('base.group_system')
#If user is distributeur, Created user will be client
if self.env.user.has_group('base.group_system'):
self.env['res.users'].create({
#'groups_id': [4, self.ref('affichage2.group_information_client')],
#'groups_id': [(6, 0, [self.ref('affichage2.group_information_client')])],
'groups_id': [(6, 0, [user_group_admin.id])],
'name': vals['name'],
#'login': vals['login'],
'email': vals['email'],
})

return res


Avatar
Discard

Please uncomment this " #'login': vals['login'], " line check whether still you get that warning

Author

Thank you Niyas i will check it

Best Answer

This error is triggered when the User record being created has no value for the login field.

Avatar
Discard