Odoo debugging Docker VSCode – Are you ready to supercharge your Odoo development process? Look no further! In this guide, we’ll walk you through setting up a powerful Odoo debugging environment using Docker and Visual Studio Code (VSCode). So, let’s dive in and revolutionize your coding experience!
Why Docker and VSCode for Odoo Development?
First things first, you might be wondering why we’re using this particular setup. Well, Docker provides a consistent and isolated environment, while VSCode offers a user-friendly interface with powerful extensions. Together, they create a dream team for Odoo development!
Getting Your Development Environment Ready
Essential Tools You’ll Need
Before we jump into the nitty-gritty, make sure you have these tools installed:
- Docker – Your containerization superhero
- Git – The time-machine for your code
- VSCode – Your trusty code editor
Additionally, don’t forget to install these VSCode extensions:
- Docker
- Odoo IDE
- Python Debugger
These extensions will turbocharge your development process, so don’t skip them!
Setting Up Your Project
Now, let’s get your project up and running:
- Clone the Project
Fire up your terminal and run:
git clone https://github.com/teguhteja/docker-odoo-dev.git -b 14
This command fetches the project template for you.
- Grab Those Odoo Stubs
Next, run this script to get theodoo-stub
folder:
./git-clone-odoo-stubs.sh
These stubs will be your best friends during development!
- Build Your Docker Image
Time to create your Odoo development image:
docker build -t odoodev:14 .
This step might take a few minutes, so grab a coffee while you wait!
- Launch Docker Compose
Now, let’s bring your Odoo 14 and PostgreSQL 16 containers to life:
docker compose up -d
Just like that, your development environment is ready to roll!
Customizing Your Odoo Environment
Adding Your Personal Touch
Want to add your own addons? It’s a breeze! Simply place them in the custom-addons
folder. After that, restart the Docker stack using the Docker extension in VSCode. Your addons will be right there, ready for action!
Debugging Like a Pro
Setting Up for Success
Now, here’s where the magic happens. Follow these steps to debug your Odoo code like never before:
- Set breakpoints in your source code within VSCode.
- Make sure your debugger is set to debug external code. To do this, set
"justMyCode": false
in yourlaunch.json
file. - Get the Odoo source code from the container:
./docker-cp-odoo.sh
- Add breakpoints in the Odoo source code.
- Fire up the debugger process and start unraveling those bugs!
Troubleshooting Tips
Overcoming Common Hurdles
Even the smoothest setups can hit a few snags. Here are some tips to keep you moving:
- Backup Failures with Docker Images
If you’re facing backup issues, try modifyingmisc.py
. This often resolves Docker-related backup problems. - Debugging Odoo Source Code
For a deeper dive into Odoo’s source, follow these steps:
- Set
"justMyCode": false
inlaunch.json
- Run
docker-cp-odoo.sh
to get the Odoo folder from the container - Uncomment this line in
docker-compose.yml
: “`yaml- ./odoo:/usr/lib/python3/dist-packages/odoo
“`
- ./odoo:/usr/lib/python3/dist-packages/odoo
- Restart your Docker stack
- Add breakpoints and start debugging!
Wrapping Up
Congratulations! You’ve just set up a powerful Odoo development environment using Docker and VSCode. With this setup, you’re well-equipped to tackle even the most challenging Odoo projects.
Remember, practice makes perfect. The more you use this setup, the more efficient you’ll become. So, start coding, start debugging, and watch your Odoo development skills soar!
For more detailed scripts and instructions, don’t forget to check out the full project repository at docker-odoo-dev. Happy coding!
Discover more from teguhteja.id
Subscribe to get the latest posts sent to your email.