From 77c708c516beb322df37220634e178ba82e894c9 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 19 Apr 2019 08:48:51 +0000 Subject: [PATCH] [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) --- addons/website/models/res_users.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/website/models/res_users.py b/addons/website/models/res_users.py index 6338a656d2c..a84eaaeb3c6 100644 --- a/addons/website/models/res_users.py +++ b/addons/website/models/res_users.py @@ -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