Nevertheless the JS framework is quite often still the only solution to problems. As the JS framework is a large subject each tutorial will focus on one task. In this series of tutorials you will learn about quite some features from the JS framework:
Broadly speaking the JS framework can be split up into a few parts:
Each of these parts of Odoo talk to the same server, written in Python, with a postgreSQL database. Speaking of the database, Odoo has made a very interesting architectural choice: many templates are stored in the database as an XML document. This is very powerful, since this allows any installed addon to be modified with a simple xpath expression. This is certainly the most important reason that the Odoo web client UI is so dynamic and extensible.
This series of tutorial will focus mostly on the web client, but many of the topics discussed will also apply to the website or the point of sale JS code.
This is the minimal amount of files required by Odoo. The "__manifest__.py" should contain a description of how the module is structured, and __init__.py makes it a python module. For now we can leave the "__init__.py" file empty. Open "__manifest__.py" and add the following values:
your_module_name/ static/ src/ js/ some_file.js some_other_file.js css/ some_file.css xml/ other_file.xml ...
Create the folder "static" and in this folder add "src" then "js" and create a new file named "hello_world.js" in the "js" folder. Your module should now have this structure:
Open the "hello_world.js" file and add a simple console.log in it:
If you now update/install the module you can open the following URL:
The next step is to ask the Odoo server to read this XML file so that this XML gets loaded into Odoo too. You can do this by adding the XML file its location in the "__manifest__.py" file in Odoo like this:
'data': [ 'views/assets.xml', ],