Becoming a superuser in Odoo 12.0

It’s a little different from before

Holden Rehg
3 min readApr 26, 2019
Photo by Esteban Lopez on Unsplash

Update — Mar 1st, 2021

Hello! If you’ve seen my articles pop up in your searches before, I really appreciate the time people have taken to read my articles. At this point, there’s been over 75k views across the 25 or so articles I’ve written here on Medium. That’s amazing to me since writing is a hobby I started doing just to try to get a bit better at writing and communicating.

I wanted to let everyone who lands on these articles that I have migrated everything over to a self hosted blog (for a bunch of reasons that I won’t get into here). So please take a look at https://holdenrehg.com/blog for all of the articles or https://holdenrehg.com/blog/2019-04-26_becoming-a-superuser-in-odoo to specifically see this article.

Thanks again! — Holden

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”.

  1. Activate Developer Mode (Setting > Activate Developer Mode)
  2. Click the Bug Icon in the top right
  3. 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

Sign up for my new project called Buster then let me know your thoughts.

Follow me on Twitter for random thoughts and articles about business software and software development. Or follow me directly here at Medium to stay up to date with my articles.

Holden

--

--

Holden Rehg

🧑‍💻 Software Freelancer and Consultant | Works mostly with #odoo and #python web apps | Writes at http://holdenrehg.com/blog