odoo-8 Add CSS and Javascript files to Odoo module


  • Note about XML syntax: As the record is made inside of XML file, you can not leave any tag unclosed as you could in a plain HTML, like: <link rel='stylesheet' href="..." >, Close the link tag instead, like:
    • <link rel='stylesheet' href="..." />


Possible values of inherit_id parametermeaning
web.assets_backendUsed in internal pages only, NOT included in a public website.
website.assets_frontendUsed in a public website only (via "website" module).
web.assets_commonUsed in both, public website and internal pages.


If you are not sure about which option is suitable for you, then try the first option (backend) as it is used in most cases and nearly in all cases if you have not installed the "website" module. Odoo differentiates between "backend" and "frontend" assets because the public website provided by the "website" module uses different styling and JS code than internal pages meant to be used for ERP tasks, i.e. "frontend" is associated with the public website and "backend" is associated with internal pages for ERP (meaning of "frontend" and "backend" are Odoo specific here, but they are both "frontend" in more general sense).

You can not only choose and use one of the options, but also use any combination of them (two of them or all of them) in the same module. Factor a backend, a frontend and a common JS/CSS code into separated files to better adhere to DRY and have suitable code in the public website and in the internal pages.

Do not forget to add "web" (when using option 1) or "website" (when using option 2) to the dependency list in the __openerp__.py manifest.