Odoo Partners

Why is Debugging Important in Odoo 15?

As the name suggests debugging is the procedure for finding and eliminating programming errors. Problem simplification, unit testing, control flow analysis, bug clustering, coordinated testing, backtracking, and profiling are examples of debugging. Even though programming errors are generally common, we should concentrate on effectively removing them. For software to operate effectively, debugging is important. For the development of the Odoo 15 enterprise, several debugging tools are available.

Accessing Developer Mode

A developer can obtain technical data about data by using the developer mode tool. As you explore the interface in developer mode, Odoo will deliver a lot more information on the screen and unlock certain technological functions. Let's understand how to activate the developer mode in Odoo ERP.

Go to Odoo interface > Settings > scroll down

Concerning the image, developer mode has been activated when you float your mouse pointer over a field, and information about that field will be displayed.

We can now see a field's name, field type, model name, and many other details. Using add-ons for Chrome and Firefox, we can access developer mode. Going to the Chrome Extensions page, we can get the Odoo to debug add-ons, which could take additional time to use in developer mode. Moving on to more sophisticated Odoo debugging, developers can now use the terminal to implement debugging. For instance, you should conduct it as a regular user (no root).

  /usr/bin/odoo.py --log-level=debug

Odoo Debugging Using The Python PDB Package

An interactive source code debugging tool for Python scripts is provided by the package pdb. It stipulates the class pdb, easily identified by reading the source code, and allows setting conditional breakpoints and single stepping at the source line level. 

Also Read: What is Odoo ERP and why is it the best choice for small and mid-scaled companies?

We can describe two lines of code from our source code inside an action or a statement, import pdb and pdb.set trace(). The execution of the code will pause here once it gets to this point. Here is the screenshot for reference.

By classifying the self and returning a function, we may get the pertinent record ID and function return, just like in the sample. We'll use set trace() to hard-code a breakpoint at a certain place in our programme and for possessing the ability to debug simply put pdb.run(). Also, pdb.runcall(function, *args, **kwds) is used, among other things, to call the function with the supplied arguments. The most widespread misperception among programmers is that the print() function in Python doubles as a debugger. Alternatively, printing() prints the value of the expression after evaluating it in the current context.

< Blogs>

More Blogs

Empowering Thoughts & Engaging Discussions

What is Knowledge Module in Odoo 16?


Why is Odoo an Ideal ERP for Food Manufacturers?


CRM Vs ERP: What’s the Difference?