Skip to content
Home » My Blog Tutorial » Master Odoo 14 Debugging with Docker in VSCode: A Comprehensive Guide

Master Odoo 14 Debugging with Docker in VSCode: A Comprehensive Guide

odoo docker debugger vscode

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:

  1. Docker – Your containerization superhero
  2. Git – The time-machine for your code
  3. 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:

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

  1. Grab Those Odoo Stubs
    Next, run this script to get the odoo-stub folder:
   ./git-clone-odoo-stubs.sh

These stubs will be your best friends during development!

  1. 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!

  1. 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:

  1. Set breakpoints in your source code within VSCode.
  2. Make sure your debugger is set to debug external code. To do this, set "justMyCode": false in your launch.json file.
  3. Get the Odoo source code from the container:
   ./docker-cp-odoo.sh
  1. Add breakpoints in the Odoo source code.
  2. 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:

  1. Backup Failures with Docker Images
    If you’re facing backup issues, try modifying misc.py. This often resolves Docker-related backup problems.
  2. Debugging Odoo Source Code
    For a deeper dive into Odoo’s source, follow these steps:
  • Set "justMyCode": false in launch.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
      “`
  • 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.

Leave a Reply

Optimized by Optimole
WP Twitter Auto Publish Powered By : XYZScripts.com

Discover more from teguhteja.id

Subscribe now to keep reading and get access to the full archive.

Continue reading