-
Notifications
You must be signed in to change notification settings - Fork 1
Debugging
Debugging is a very important skill in order to learn odoo program in depth.
Process of debugging is to understand the flow of program and understanding how your interaction with the software triggers the code that is running in the backend.
Code debugging is separated for python and javascript. For Python, we usually use pudb or vscode's own debugger.
For Javascript, we usually load all assets and use chrome's own debugging tools.
Internally, the default python debugger on VSCode is using debugpy.
Before doing debugging, here are some checklists you need to fulfill before starting:
- Setting up odoo-bin and python virtual environment (refer to Installation)
- General understanding of using odoo-bin to run locally (w/ terminal)
Follow these steps:
- Open your VSCode on the upper level folder. Which means that in your file explorer you should be seeing this sort of structure:
/home/odoo
|__ Github/
|__ odoo/ # Odoo Community
|__ enterprise/ # Odoo Enterprise
|__ envs/ # Virtual environments
|__ psbe-ps-tech-tools/ # ps tool
|__ support-tools/ # support tool
- Find/Open any python file, Go to Debug section on VSCode and create launch.json file. An initial configuration is created, we will create new configurations.
- Inside the configurations list add
{
"name": "SMB",
"type": "python",
"request": "launch",
"program": "/home/odoo/Github/odoo/odoo-bin",
"python": "${workspaceFolder}/envs/v14/bin/python3",
"args": [
"--addons-path",
"${workspaceFolder}/odoo/addons,${workspaceFolder}/enterprise,${workspaceFolder}/design-themes/",
"-d",
"smb_test", // database
],
"console": "externalTerminal"
},- name: Name of config
- program: root file to run program: path to odoo-bin
- python: which python interpreter to run. Use the one stored on your virtual environment file
- args: all arguments to be supplied to odoo-bin
- Try running
- Put breakpoints on the code.Hover of the line number and red circle should appear.
- When you run your code, it will stop the line you have chosen as your breakpoint.
PUDB is a very helpful debugger to put debugging capability in ANY python code. Although the VSCode debugging is powerful and user-friendly, some developments we are going to do may not be able to be covered by it. More example of this will explained later.
- Install pudb using your virtual environment
pip3 install pudb
- Modify the code. Only do this locally.

- Debugging with pudb. If you are in python file, don't forget to import pudb on the beginning of the file. Put breakpoint by inserting:
pudb.set_trace()
which when you run the code will pop open and show the console for debugging. You can learn more about commands on the pudb link
You can only debug javascript when it is loaded. I hope you are using chrome to do this.
Install this chrome extension first.
- Run odoo-bin first. Double-click to make mode asset debugging
- Open chrome debug (F12 Key). Go to Sources and find the javascript file using (Ctrl+P)
- Put breakpoint inside your javascript file.
General Rules
Presales
What counts as LOC
Training Request
Third Party App
Third Party App for Sales
Integrations for Sales and FC
Saas to SH
HK Tech Onboarding
Pre Commit Setup
Visual Code Setup
Creating New SH Project
Upgrade/Migration Scripts (Technical)
Currency Rounding Script
Saas Customization
New
Analysis
Waiting for Client Go
Planning
Development
Code Review
Functional Testing
Client Validation
Fail Validation
Merge
Done
Help & Training
--> New Project
--> Project follow-up
--> New Pack (Upsell)
--> Project handover
--> Unassigned
--> Assigned
--> Kickoff and Qualification
--> Configuration
--> Production
--> In support
--> Cancelled
--> Upsell Done
--> On Hold
--> Churn
--> Introduction
--> Upgrade Workflow
--> Timesheeting for FC
--> FAQ Upgrade
--> Additional Documentations/References