How it works...

In step 1, we hard code a break point in the source code of the method by calling the set_trace() method of the pdb module from the Python standard library. When this method is executed, the normal flow of the program stops, and you get a (Pdb) prompt in which you can enter pdb commands.

Step 2 calls the stock_level_export() method using the shell mode. It is also possible to restart the server normally and to use the web interface to generate a call to the method you need to trace by clicking on the appropriate elements of the user interface.

When you need to manually step through some code using the Python debugger, here are a few tips that will make your life easier:

  • Reduce the logging level to avoid having too many log ...

Get Odoo 11 Development Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.