Skip to content
Snippets Groups Projects
Commit 0c9c849e authored by Nicolas Martinelli's avatar Nicolas Martinelli
Browse files

[FIX] base_setup: Default Access Rights


Prevent crash in case `base.default_user` has been deleted.

Note that the user shouldn't be deleted in a first place, but that's
another discussion...

opw-2360615

closes odoo/odoo#60752

Signed-off-by: default avatarNicolas Martinelli (nim) <nim@odoo.com>
parent 3a00d154
Branches
Tags
No related merge requests found
......@@ -2,6 +2,7 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
from odoo.exceptions import UserError
class ResConfigSettings(models.TransientModel):
......@@ -71,7 +72,10 @@ class ResConfigSettings(models.TransientModel):
@api.multi
def open_default_user(self):
action = self.env.ref('base.action_res_users').read()[0]
action['res_id'] = self.env.ref('base.default_user').id
if self.env.ref('base.default_user', raise_if_not_found=False):
action['res_id'] = self.env.ref('base.default_user').id
else:
raise UserError(_("Default User Template not found."))
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.
Please register or to comment