In older versions of Odoo, prior to version 12.0, every instance was created with a default user called Administrator with a primary database id of 1.
In the code, you’ll find this little gem:
# The hard-coded super-user id (a.k.a. administrator, or root user). SUPERUSER_ID = 1
Easy but dangerous
This made things easy for developers. Most developers probably always logged in as the administrator user, especially on their local environments. So every time they logged in they had full access to all resources. Maybe you still had to add a certain group here or there, but generally you have access to everything.
This also used to make things dangerous.
Developers who weren’t writing automated tests, never tested the system from the actual users point of view. This leads to lots of emails and complaints like “I clicked the Tasks menu and got an Access Denied error”.
What’s different in 12.0?
Now in version 12.0, we have segregation between the Administrative user and the actual superuser.
Don’t worry, there’s still that nice snippet in core that says
SUPERUSER = 1 but the default user,
who is now called “Mitchell Admin”, has an id of 2.
You don’t even have the ability to see a user with an id of 1 in the Settings > Users list. It doesn’t seem to exist anymore from. Or it’s at least not accessible from the GUI.
So how do I become superuser?
But there’s been a link added to the developer mode menu to “Become Superuser”.
- Activate Developer Mode (Setting > Activate Developer Mode)
- Click the Bug Icon in the top right
- Click Become Superuser, which will add a yellow striped banner
With great power comes great responsibility
As a developer, you’ll want to use this with some caution. It’s easy to fall back into the trap of always being logged in as the superuser and ignoring all the permissions all of the time.
So use it only when you have to.
And as usual, test! test! test!
Thanks For Reading
I appreciate you taking the time to read any of my articles. I hope it has helped you out in some way. If you're looking for more ramblings, take a look at theentire catalog of articles I've written. Give me a follow on Twitter or Github to see what else I've got going on. Feel free to reach out if you want to talk!