diff options
| author | Nicolas Martinelli <nim@odoo.com> | 2020-04-03 14:50:28 +0000 |
|---|---|---|
| committer | Nicolas Martinelli <nim@odoo.com> | 2020-04-06 16:22:31 +0000 |
| commit | 1766d3281eec1c23c012049f615097236e43598d (patch) | |
| tree | 7309c22aa1d55727ee7997ba41dd50180af87c49 /addons/auth_signup/controllers | |
| parent | 2b776cbbb5e5a9c9dd8b68933c70080cae5f28e0 (diff) | |
[FIX] auth_signup, website, base: identical logins
- Create a website:
Free sign up
Specific User Account activated
- In the backend, create a partner "test@test.com"
- Grant him portal access
=> user is not website-specific
- Go to the website, Sign Up with "test@test.com"
=> user is website-specific
At login, an expected singleton error arises at:
https://github.com/odoo/odoo/blob/c53f1c6a58b4c8c9e9b3c87f27281c9bfd65a0e1/odoo/addons/base/models/res_users.py#L613
Because this matches both users:
https://github.com/odoo/odoo/blob/c53f1c6a58b4c8c9e9b3c87f27281c9bfd65a0e1/addons/website/models/website.py#L44
When such a case arises, we make sure to always select the most specific
user first.
opw-2219618
closes odoo/odoo#49089
X-original-commit: 9e217125c0d8c951e895e9799795ac29b7962107
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Diffstat (limited to 'addons/auth_signup/controllers')
| -rw-r--r-- | addons/auth_signup/controllers/main.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/addons/auth_signup/controllers/main.py b/addons/auth_signup/controllers/main.py index 3b6b92afd54..6fc0c58f919 100644 --- a/addons/auth_signup/controllers/main.py +++ b/addons/auth_signup/controllers/main.py @@ -37,7 +37,10 @@ class AuthSignupHome(Home): self.do_signup(qcontext) # Send an account creation confirmation email if qcontext.get('token'): - user_sudo = request.env['res.users'].sudo().search([('login', '=', qcontext.get('login'))]) + User = request.env['res.users'] + user_sudo = User.sudo().search( + User._get_login_domain(qcontext.get('login')), order=User._get_login_order(), limit=1 + ) template = request.env.ref('auth_signup.mail_template_user_signup_account_created', raise_if_not_found=False) if user_sudo and template: template.sudo().send_mail(user_sudo.id, force_send=True) |
