Adding CSS and JavaScript assets

Our website pages might need some additional CSS or JavaScript assets. This aspect of the web pages is managed by the website, so we need a way to tell it to also use our files.

We will add some CSS to add a simple strikeout effect for completed tasks. For that, create the todo_website/static/src/css/index.css file with the following content:

.todo-app-done { 
    text-decoration: line-through; 
} 

Next, we need to have it included in the website pages. This is done by adding them in the website.assets_frontend template, responsible for loading website-specific assets. Edit the todo_website/views/todo_templates.xml data file to extend that template:

<odoo> <template id="assets_frontend" name="todo_website_assets" ...

Get Odoo 11 Development Essentials - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.