Why this chapter? Most of the debugging time I've billed clients over the years wasn't spent reading code — it was spent watching the DevTools Network and Console tabs. Knowing this tooling cold is what separates guessing from diagnosing. What is Odoo trying to solve with this? Odoo doesn't ship its own debugger — it relies entirely on your browser's DevTools and a properly configured editor/server loop (
--dev=all), so this chapter is about the generic web tooling every Odoo frontend developer depends on. Real-world application: When a client reports "the button doesn't do anything," the Console and Network tabs from this chapter are almost always where you find the actual error — long before you go anywhere near the OWL source.
Before a chef can cook a masterpiece, they must know their knives. Before a carpenter can build a table, they must master their saw and hammer. For a developer, our tools are just as critical. Writing code is only half the battle; the other half is debugging, inspecting, and understanding what our code is doing.
This chapter introduces the most important tool in your arsenal: your web browser's Developer Tools. We'll also cover the essential setup you need in your code editor and provide hands-on exercises to get you comfortable with these tools. Mastering these tools is not optional—it's the fastest way to go from a beginner who is guessing what's wrong to a professional who knows how to find out.
The Browser is Your Best Friend
Every modern web browser (like Chrome, Firefox, or Edge) comes with a powerful suite of built-in "DevTools". You can usually open them by right-clicking anywhere on a webpage and selecting "Inspect" or by pressing the F12 key.
For an Odoo developer, the DevTools are your window into the soul of your application. They let you see the HTML structure, watch communication with the Odoo server, and debug your JavaScript line by line. Let's explore the four most important tabs.
The Console: Your Code's Diary
The Console is the first place you should look when something goes wrong. It's a live log where JavaScript can print messages, warnings, and—most importantly—errors.
What it's for:
* Seeing Errors: When your OWL component crashes, a detailed error message will appear here, often telling you the exact line of code that failed.
* Logging Variables: You can print the value of any variable from your code using console.log(). This is the simplest way to check the state of your component at any given moment.
* Interactive Testing: You can type JavaScript directly into the console and execute it immediately—perfect for testing small pieces of code.
How to use it:
Imagine you want to see what data is inside a variable called this.state.tasks. In your component's JavaScript, you would add:
console.log("The current tasks are:", this.state.tasks);
When your code runs, this message will appear in the Console, allowing you to inspect the data.
Pro tip: You can use different console methods for different types of messages:
console.log("General information");
console.warn("This is a warning");
console.error("This is an error");
console.table(arrayOfObjects); // Displays arrays/objects as neat tables
The Elements Tab: The Live HTML
The Elements tab shows you the complete, live HTML and CSS of the page you are looking at. This isn't the source code you wrote; it's the final product after your browser has rendered everything, including the HTML generated by your OWL components.
What it's for:
* Inspecting Structure: You can see exactly how your OWL component's template was turned into HTML. Is that div inside another div like you expected?
* Testing CSS Changes: You can select any element and add, remove, or change its CSS styles directly in the browser to see the effect instantly. This is perfect for quickly testing visual changes without having to modify your code and reload.
* Finding CSS Issues: When something doesn't look right, you can inspect the element to see which CSS rules are being applied and which ones are being overridden.
Pro tip: Right-click on any element in the Elements tab and select "Copy selector" to get the exact CSS selector for that element.
The Network Tab: Spying on the Server
The Network tab is your mission control for all communication between your browser and the Odoo server. Every time your OWL component makes an RPC call to fetch data, you will see it here.
What it's for: * Watching RPC Calls: When you click a button that should save data, you can watch the Network tab to confirm that a call was made to the Odoo server. * Inspecting Payloads: You can click on any request to see exactly what data was sent to the server (the "payload") and what data the server sent back in its response. This is invaluable for debugging issues where the data seems incorrect. * Performance Monitoring: You can see how long each request takes and identify slow operations.
Pro tip: Use the filter buttons (XHR, JS, CSS, etc.) to show only the type of requests you're interested in. For Odoo development, you'll often want to filter by "XHR" to see only the data requests.
The Sources Tab: The Ultimate Debugger
The Sources tab is the most powerful, and perhaps most intimidating, tool. It allows you to pause your code mid-execution and inspect everything.
What it's for: * Setting Breakpoints: You can pick a line in your JavaScript code and set a "breakpoint." When the browser gets to that line, it will pause the entire application. * Inspecting State: While paused, you can hover over any variable to see its current value. You can see the entire call stack (which functions called which other functions) and step through your code one line at a time. * Live Code Editing: In some cases, you can even edit the code directly in the browser and see the changes immediately.
Pro tip: You can set conditional breakpoints that only pause when certain conditions are met. Right-click on a line number and select "Add conditional breakpoint."
Your Code Editor & Odoo Setup
While the browser is for inspecting the result of your code, your code editor is where you write it.
Visual Studio Code: Your Development Command Center
Visual Studio Code (VS Code) is the industry standard for modern web development. It's free, powerful, and has excellent support for JavaScript, Python, and XML—all languages you'll use in Odoo development.
Essential Extensions for Odoo Development
Here are the must-have VS Code extensions that will make your Odoo/OWL development much more efficient:
For JavaScript/OWL: * JavaScript (ES6) Code Snippets: Quick shortcuts for common JavaScript patterns * Auto Rename Tag: Automatically renames paired HTML/XML tags
Note: Bracket pair colorization is now built into VS Code (Settings → "Bracket Pair Colorization")—no extension needed.
For Python/Odoo: * Python: Official Python extension with syntax highlighting and debugging * Pylance: Advanced Python language server for better code intelligence * autoDocstring: Automatically generates Python docstrings
For XML/QWeb: * XML Tools: Formatting and validation for XML files * Auto Close Tag: Automatically closes XML/HTML tags * XML Language Support: Enhanced XML editing features
General Productivity: * GitLens: Supercharged Git capabilities * Material Icon Theme: Better file icons for different file types * Thunder Client: API testing directly in VS Code (great for testing Odoo RPC calls)
Odoo Server Configuration
To make Odoo automatically reload your JavaScript and CSS changes without needing a manual server restart, you should run Odoo with the --dev=all flag. This is crucial for an efficient development workflow.
./odoo-bin -c your_config_file.conf --dev=all
The --dev=all flag enables:
* Automatic reloading of Python code
* Automatic reloading of JavaScript and CSS assets
* Automatic reloading of XML views and templates
* Enhanced error messages and debugging information
Hands-On Practice: Getting Comfortable with the Tools
Let's put these tools to work with some practical exercises. These will help you become comfortable with the DevTools before we start building OWL components.
Exercise 1: Console Exploration
- Open any Odoo instance (or any website) in your browser
- Open the DevTools by pressing
F12or right-clicking and selecting "Inspect" - Go to the Console tab
- Try these commands (type each one and press Enter):
javascript console.log("Hello, OWL world!"); console.warn("This is a warning message"); console.error("This is an error message"); console.table([{name: "Alice", age: 25}, {name: "Bob", age: 30}]); - Notice how different console methods display information in different ways
Exercise 2: Element Inspection
- Navigate to an Odoo form view (like editing a contact or product)
- Right-click on any button and select "Inspect"
- Observe the HTML structure in the Elements tab
- Try changing the button text by double-clicking on the text in the HTML and typing something new
- Add a CSS style by clicking on the "Styles" panel and adding a new property like
background-color: red; - Watch the button change in real-time
Exercise 3: Network Monitoring
- Open the Network tab before performing any actions
- Click "Save" on any Odoo form (like editing a contact)
- Watch the requests appear in the Network tab
- Click on one of the requests to see the details
- Look at the "Payload" or "Request" tab to see what data was sent
- Look at the "Response" tab to see what the server sent back
Exercise 4: Setting Your First Breakpoint
- Find any JavaScript file in the Sources tab (look for
.jsfiles) - Click on a line number to set a breakpoint (a red dot will appear)
- Perform an action that would trigger that code
- When the code pauses, hover over variables to see their values
- Use the controls (play, step over, step into) to control execution
Exercise 5: VS Code Setup Check
- Install VS Code if you haven't already
- Install at least 3 extensions from the list above
- Open an Odoo addon folder in VS Code
- Try opening a Python file and verify syntax highlighting works
- Try opening an XML file and verify the XML extension is working
Troubleshooting Common Setup Issues
DevTools won't open: Try different methods—F12, Ctrl+Shift+I (Windows/Linux), or Cmd+Option+I (Mac).
No syntax highlighting in VS Code: Make sure you've installed the appropriate language extensions and that VS Code recognizes the file type (check the bottom-right corner).
Odoo not reloading changes: Verify you're running with --dev=all and check the console for any error messages.
Can't find JavaScript files in DevTools: Look for your files under the "Sources" tab, often in a folder structure that mirrors your Odoo addon.
With your browser's DevTools and a properly configured editor and server, you have a professional-grade workshop. The hands-on exercises above will help you become comfortable with these tools before we dive into JavaScript fundamentals. Remember: the more comfortable you are with debugging and inspection, the more effective and efficient you will be as a developer.
TL;DR: Your browser's DevTools (Console, Sources, Network) plus a properly configured editor and --dev=all server are the non-negotiable baseline toolkit for any OWL debugging you'll do in this book — and in real projects.
Try it yourself: This chapter's example is available as an installable Odoo 19 addon: simplifyit_owl_book_ch2_ex1. Installation instructions are in the repository README.
What's Next?
In the next chapter, we'll start building the JavaScript knowledge you need to create powerful OWL components.