Skip to Content
Menu
This question has been flagged
1162 Views

Hi,

I am trying to grant portal access and create user automatically when I create a customer. But not working.

This my code in python:

group_portal=self.env.ref('base.group_portal')
self.env['res.users'].create({                       
    'name': partner.name,                       
    'login': partner.email,                       
    'partner_id': partner.id,
    'groups_id': [(4, group_portal.id)]                   
})

Thanks.

Avatar
Discard