.. _reference/assets: ====== Assets ====== Managing assets in Odoo is not as straightforward as it is in some other apps. One of the reasons is that we have a variety of situations where some, but not all of the assets are required. For example, the needs of the web client, the point of sale app, the website or even the mobile application are different. Also, some assets may be large, but are seldom needed: in that case we may want them to be :ref:`loaded lazily (on demand) `. Bundles ======= Odoo assets are grouped by *bundles*. Each bundle (a *list of file paths* of specific types: `xml`, `js`, `css` or `scss`) is listed in the :ref:`module manifest `. Files can be declared using `glob `_ syntax, meaning that you can declare several asset files using a single line. The bundles are defined in each module's :file:`__manifest__.py`, with a dedicated `assets` key which contains a dictionary. The dictionary maps bundle names (keys) to the list of files they contain (values). It looks like this: .. code-block:: py 'assets': { 'web.assets_backend': [ 'web/static/src/xml/**/*', ], 'web.assets_common': [ 'web/static/lib/bootstrap/**/*', 'web/static/src/js/boot.js', 'web/static/src/js/webclient.js', ], 'web.qunit_suite_tests': [ 'web/static/src/js/webclient_tests.js', ], }, Here is a list of some important bundles that most odoo developers will need to know: - `web.assets_common`: this bundle contains most assets which are common to the web client, the website and also the point of sale. This is supposed to contain lower level building blocks for the odoo framework. Note that it contains the :file:`boot.js` file, which defines the odoo module system. - `web.assets_backend`: this bundle contains the code specific to the web client (notably the web client/action manager/views) - `web.assets_frontend`: this bundle is about all that is specific to the public website: ecommerce, portal, forum, blog, ... - `web.assets_qweb`: all static XML templates used in the backend environment and in the point of sale. - `web.qunit_suite_tests`: all javascript qunit testing code (tests, helpers, mocks) - `web.qunit_mobile_suite_tests`: mobile specific qunit testing code Asset types =========== There are three different asset types: code (`js` files), style (`css` or `scss` files) and templates (`xml` files). Code Odoo supports :ref:`three different kinds of javascript files`. All these files are then processed (native JS modules are transformed into odoo modules), then minified (if not in `debug=assets` :ref:`mode `) and concatenated. The result is then saved as a file attachment. These file attachments are usually loaded via a `