[FIX] website: sign-up in multi-website
- Create 2 companies A & B - For each company, create a website linked to a different URL and activate 'Free sign up' and 'Specific User Account'. - As a public user, go to website of company B - Go to 'Sign in > Don't have an account?' and create an account The user is created in company A (the company of the user template) instead of company B (the company of the website). We set the company of the user based on the company of the website. opw-1962197 closes odoo/odoo#32823 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
@@ -35,10 +35,12 @@ class ResUsers(models.Model):
|
||||
|
||||
@api.model
|
||||
def _signup_create_user(self, values):
|
||||
new_user = super(ResUsers, self)._signup_create_user(values)
|
||||
current_website = self.env['website'].get_current_website()
|
||||
if request and current_website.specific_user_account:
|
||||
new_user.website_id = current_website
|
||||
values['company_id'] = current_website.company_id.id
|
||||
values['company_ids'] = [(4, current_website.company_id.id)]
|
||||
values['website_id'] = current_website.id
|
||||
new_user = super(ResUsers, self)._signup_create_user(values)
|
||||
return new_user
|
||||
|
||||
@api.model
|
||||
|
||||
Reference in New Issue
Block a user