Sometimes, application logs are not enough to figure out what is going wrong. Fortunately, we have the Python debugger available to us. This recipe shows how to insert a break point in a method and trace the execution by hand.
We will be reusing the
export_stock_level() method shown in the two previous recipes. Be sure to have a copy at hand.
In order to trace the execution of
pdb, follow the following steps:
def export_stock_level(self, stock_location): import pdb; pdb.set_trace() products = self.with_context( location=stock_location.id ).search() fname = join(EXPORTS_DIR, 'stock_level.txt') ...