If you work with Odoo on a technical level, whether you’re a developer, system administrator, or advanced user, there’s one tool you absolutely need to know about. That tool is the Odoo Shell. It’s powerful, flexible, and once you understand how it works, it becomes one of the most useful utilities in your entire Odoo workflow.
In this guide, we’re going to answer the most common questions people have when they first come across it: What is Odoo Shell? How do you access it? What can you actually do with it? And what should you be careful about?
Let’s get into it.
Table of Contents
What is Odoo Shell?
So, what is Odoo Shell, exactly?
The Odoo Shell is an interactive command-line interface (CLI) that gives you direct access to the Odoo environment from your server terminal. Think of it as a Python REPL (Read-Eval-Print Loop) that is pre-loaded with everything Odoo: your database, your models, your records, your ORM, all available right there, ready to be queried or modified in real time.
In simpler terms, the Odoo Shell lets you run Python code directly against your live Odoo database without going through the web interface. You can search records, create or update data, call methods on models, debug issues, and perform bulk operations — all from the command line.
This makes the Odoo Shell an incredibly powerful tool for developers who need to test code quickly, administrators who need to fix data issues, or anyone who wants to interact with Odoo at a lower level than the standard web UI allows.
Why is the Odoo Shell Useful?
Before diving into how to access it, it’s worth understanding why the Odoo Shell is so valuable. Here are the most common real-world use cases:
- Quick Debugging When something breaks in your Odoo instance, the Odoo Shell lets you poke around the database and test logic interactively. Instead of writing a temporary module just to test one function, you can run the code directly in the shell and see results instantly.
- Bulk Data Operations: Need to update a field across 10,000 product records? Doing that through the Odoo UI would take hours. With the Odoo Shell, a single Python loop can do it in seconds.
- Testing ORM Queries: If you’re building a custom module, you can test your
search(),read(),write(), andcreate()calls directly in the Odoo Shell before putting them in your code. This speeds up development significantly. - Fixing Data Corruption Sometimes data gets into a state the UI won’t let you fix — orphaned records, broken relationships, invalid field values. The Odoo Shell gives you the access needed to correct these issues directly.
- Running One-Off Scripts: Not every task needs a full Odoo module. The Odoo Shell lets you run quick Python scripts against your database without any of the module overhead.
How to Access the Odoo Shell
Now that you understand what is Odoo Shell and why it matters, let’s look at how to actually open it. A few different methods depend on your setup.
Method 1 – Via Command Line (Most Common)
This is the standard way to open the Odoo Shell on a Linux server.
Step 1: Open your terminal and navigate to your Odoo installation directory — usually something like /opt/odoo or /home/odoo/odoo.
Step 2: Run this command:
python3 odoo-bin shell -d your_database_name
```
Replace `your_database_name` with your actual database name. If you're unsure, check Odoo Settings or your PostgreSQL connection.
**Step 3:** Wait a few seconds for the environment to load. Once ready, you'll see:
```BashYou’re in. The environment, ORM, and your entire database are now accessible.
Method 2 – With a Config File
Most production setups use a config file. Pass it when launching the shell:
python3 odoo-bin shell -d your_database_name -c /etc/odoo/odoo.confBashThis ensures the shell loads with the correct add-on paths and server settings.
Method 3 – Access Odoo Shell Via Docker
If Odoo runs in Docker, enter the container first:
docker exec -it your_container_name bash
```
Then run the standard shell command inside the container.
---
### Method 4 — On Windows (Local Dev)
Open Command Prompt or PowerShell, navigate to your Odoo folder, and run:
```
python odoo-bin shell -d your_database_nameBashNote: Production Odoo is almost always on Linux. Windows is for local development only.
Basic Commands Inside the Odoo Shell
Once you’re in, here’s what you need to know right away.
The Three Default Objects:
env: the Odoo environment (gateway to all models)self: reference to the admin user recordcr: database cursor for raw SQL if needed- Official Document
Search Records using Odoo Shell
partners = env['res.partner'].search([('customer_rank', '>', 0)])
print(len(partners))PythonRead a Record using Odoo Shell
partner = env['res.partner'].browse(1)
print(partner.name)
print(partner.email)PythonCreate a Record using Odoo Shell
new_cat = env['product.category'].create({'name': 'New Category'})
env.cr.commit()PythonDelete a Record using Odoo Shell
record = env['product.product'].browse(99)
record.unlink()
env.cr.commit()PythonCritical Rule: Always Commit Your Changes
The Odoo Shell does not auto-save. Any create, write, or unlink call must be followed by:
env.cr.commit()PythonExit without committing, and everything rolls back automatically. This is actually a useful safety net; you can test destructive operations freely, as long as you don’t commit until you’re certain.
To manually undo changes before committing:
env.cr.rollback()PythonOdoo Shell vs Odoo Console – What’s the Difference?
These two get confused often, but they are completely different tools.
- The Odoo Shell is server-side. It runs on your server, connects directly to your database, and gives you full Python access to the Odoo ORM. This is the tool this article is about.
- The Odoo Console refers to the browser developer tools, the client-side JavaScript console that lets you inspect the DOM and debug frontend behaviour in the Odoo web interface.
When developers and sysadmins say “the shell,” they always mean the server-side Odoo Shell.
Real-World Examples
Here are some real-world examples that you can try in your local odoo shell:
Reset an Admin Password
user = env['res.users'].browse(1)
user.write({'password': 'newpassword123'})
env.cr.commit()PythonBulk Price Update (10% increase)
products = env['product.product'].search([])
for p in products:
p.write({'list_price': p.list_price * 1.10})
env.cr.commit()PythonFind All Inactive Partners
inactive = env['res.partner'].search([('active', '=', False)])
print(len(inactive)PythonRelated Post:
>> What is Odoo Runbot and How to Access It?
>> What is A/B Testing in Odoo
>> How to Configure Odoo with Nginx as a Reverse Proxy
Safety Tips Before You Start
- Test on staging first. Never run untested commands on a production database.
- Take a backup before bulk operations. Five minutes of backup time can save hours of recovery.
- Use the ORM, not raw SQL. Raw
cr.execute()bypasses security rules and workflow triggers. Stick to the ORM wherever possible. - Keep a log. Write down what commands you ran on production. Future-you will thank you.
Final Thoughts
What is Odoo Shell? It’s the fastest, most direct way to interact with your Odoo database outside of the web UI. Whether you’re a developer testing new code, an admin fixing a data issue, or a power user running a bulk operation, the Odoo Shell gives you a level of control that the web interface simply cannot match.
Learn the basics, respect the power it gives you, and it’ll become one of the most-used tools in your Odoo toolkit.
Frequently Asked Questions
Q1. What is Odoo Shell in simple terms?
Answer: It’s a Python command-line tool that lets you interact directly with your Odoo database – search, create, update, and delete records without using the web interface.
Q2. Does the Odoo Shell work on Odoo 16 and 17?
Answer: Yes. The Odoo Shell is available in Odoo 10 through the latest versions. The core commands and syntax remain consistent.
Q3. Do I need Python experience to use the Odoo Shell?
Answer: Basic Python knowledge helps, but you don’t need to be an expert. The four core patterns search(), browse(), write(), and commit() cover most everyday tasks.
Q4. Can I accidentally break my database?
Answer: Yes, which is exactly why you should always test on staging and take backups first. The shell bypasses the UI’s safety checks.
Q5. What if I forget to commit?
Answer: No problem, your changes simply roll back when you exit. Nothing is lost or broken.
Q6. Is there a GUI version of the Odoo Shell?
Answer: Not officially. Some third-party Odoo IDEs offer shell-like interfaces, but the standard Odoo Shell is purely command-line.
Have a question about What is Odoo Shell? Leave a comment below.



