Skip to content
Snippets Groups Projects
Commit f1906f4b authored by Saurabh Choraria's avatar Saurabh Choraria
Browse files

[FIX] base: prevent traceback when Portal User Template is not found


When user deletes 'Portal User Template' record from 'res.users' model and when
'action_open_template_user' function is executed at that time traceback is
generated on the user side as well as in the log.

Steps to reproduce:
    1. Install Website module.
    2. Go to settings > Users&Companies > Users.
    3. Remove Internal Users from default filter.
    4. Add Inactive Users in filter and delete Portal User Template.
    5. Go to Website Settings > Privacy > Customer Account.
    6. Click on Free sign up and then on Save button.
    7. Now in Website Settings click on Default Access Rights button.
    8. The error will occur.

Applying this commit will fix this issue.

sentry-4184456381

closes odoo/odoo#121757

Signed-off-by: default avatarRémy Voet <ryv@odoo.com>
parent a60a477b
No related branches found
No related tags found
No related merge requests found
......@@ -761,7 +761,7 @@ class ResConfigSettings(models.TransientModel, ResConfigModuleInstallationMixin)
template_user_id = literal_eval(self.env['ir.config_parameter'].sudo().get_param('base.template_portal_user_id', 'False'))
template_user = self.env['res.users'].browse(template_user_id)
if not template_user.exists():
raise ValueError(_('Invalid template user. It seems it has been deleted.'))
raise UserError(_('Invalid template user. It seems it has been deleted.'))
action['res_id'] = template_user_id
action['views'] = [[self.env.ref('base.view_users_form').id, 'form']]
return action
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment