Skip to main content

Odoo Javascript Debugging

When it comes to programming, we can all agree that out code is rarely work on a first try. Because of the sheer virtue of fact that, even if you can conceptualize a problem and reduce it to it’s base states, to fully envision it into it’s most granular detail in terms of hundreds of lines of code - Is just not realistic.
Thats why i can say that debugging is crucial part of programming. Here few tips to do javascript debugging in odoo using google chrome developer tools. some points also applicable on debugging general website not just odoo.

Odoo Developer Mode (with assets)


When it comes to javascript debugging in odoo, we should enable ‘asset debugging’. Trust me it will saves your ass a lot of time.

Odoo internally use assets like CSS and JavaScript. In normal mode this asset will combined to a file. So debug with assets will prevent asset to be merged to one file and display actual CSS and JavaScript files on chrome dev tools. Of course this mode will reduce performance but it will give you proper error message in console if you are doing some JavaScript changes in odoo.

Normal Debug Mode


Assets Debug Mode


Bonus

Debugging : Breakpoint


By using chrome developer tools we can add debugging syntax on js file without coding it in the actual file. So the actual file will remain clean from your console.log

  1. Go to source code in chrome developer tool and add breakpoint by right click → edit breakpoint


  1. Code the syntax debugging(console.log) in that breakpoint. Then reload page and check from browser console as usual

Track js method : Record Interface Process


There is a tool in chrome dev tool called “performance” (used to called timeline) to record user interaction with the web page. By doing this we can check what method triggered when we interact with the web page. For example when we click certain button in the web page, we can check what methods is triggered. The tricky part is we need to filter all the processes that recorded by “guessing” the method name.
For example i want to track what method triggered when i click odoo calendar cell
  1. Go to performance google dev tool
  1. Do interface interaction in this case i click the calendar cell in odoo

  1. Go to event log and filter the events to locate the right event. In this case we can filter it using keyword “create” since when we click calendar cell it will trigger wizard to create “meeting”

Track js method : Networking


The other chrome dev tool that really useful in this case is “Network”. By using this tool we can record all user interaction and view related record triggered specifically the methods that interact with backend such as database manipulation (CRUD)


The way to use it is no different than “performance tool”. User need to open this tool and then hit record button and do desired user interaction to web page. We can also view js methods flow by clicking the file in “initiator” tab.

Comments

  1. Casino Queen - Las Vegas, NV - Mapyro
    Find 공주 출장안마 your 공주 출장안마 nearest Casino Queen in Las Vegas, NV. Casino Queen is a non-stop 세종특별자치 출장안마 fun place to get away from all of your favorite casino 서귀포 출장안마 games and entertainment 문경 출장마사지

    ReplyDelete

Post a Comment

Popular posts from this blog

Odoo: Get File Name of Uploaded Binary File

When uploading a file binary on odoo sometimeS we need to store the original file name for informative purpose. So thats why this tutorial will come in handy. well that was ridiculously fast !!! Things that need to take into account is make sure you add those xml on your formview because most of uploading file operation happen in formview. And then ypu can use the field file name in treeview.

Odoo: Create Sequence or Running Number

Odoo sequence ussually needed for automatically generated and suppose to be unique value to identified certain object or in this context is document. For example company need unique document number for every Sales document they have. When we need to create NEW sequence in odoo ? When we have new object and this object suppose to have unique and auto generated number. in this example we have new object called 'sale.doc' will be used to store any document related to SO such as contract, delivery doc etc. 1. create xml code to declare the sequence 2. call the sequence and set it on certain char field ('name) that belongs to the same object