How to do it...

What makes debugging client-side script difficult is that the web client heavily relies on jQuery's asynchronous events. Given that break points halt execution, there is a high chance that a bug caused by timing issues will not occur when debugging. We'll discuss some strategies for this later:

  1. For the client side debugging, you will need to activate debug mode with the assets. If you don't know how to activate debug mode with the assets rede the Activating the Odoo developer tools recipe from Chapter 1, Installing the Odoo Development Environment.
  2. In the JavaScript function you're interested in, call the debugger:
debugger;
  1. If you have timing problems, log in to the console through a JavaScript function:
console.log(“I'm in function X currently”);
  1. If you want to debug during template rendering, call the debugger from QWeb:
<t t-debug=““ />
  1. You can also have QWeb log in to the console, as follows:
<t t-log=“myvalue” />

All of this relies on your browser offering the appropriate functionality for debugging. While all major browsers do that, we'll only look at Chromium here, for demonstration purposes. To be able to use the debug tools, open them by clicking on the top-right menu button and selecting More tools|Developer tools:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset