Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


How css and js inheritance works on Odoo v8?

Grover Menacho
on 6/24/14, 11:46 AM 13,149 views

Hello everyone.

I've been working with OpenERP (now Odoo) for a long time. But now I'm a little bit confused. I used to inherit point_of_sale and add css on __openerp__.py. But now that it changed and now css files are called inside html_template under point_of_sale/controllers/main.py and also js files are inserted on point_of_sale/views/point_of_sale.xml I am really confused about how this works and how should I add css from my multiple POS addons. I don't want to override and add my css because this should be inheritable. So please can someone explain me how this works?

This question has been included in the official documentation.


| 6 5 8


On 6/24/14, 12:17 PM

In v8 adding of static files is different as v7.

You must define static files in view, where you inheriting core views.

1. in module folder create folder named views

2. create in where file named: you_module_name.xml

3. in __openerp.py__ add: 'data': ['views/you_module_name.xml']

4. in you_module_name.xml add: 

<?xml version="1.0" encoding="utf-8"?>
        <template id="assets_backend" name="you_module_name assets" inherit_id="web.assets_backend">
            <xpath expr="." position="inside">
                <link rel="stylesheet" href="/you_module_name/static/src/css/you_module_name.css"/>
                <script type="text/javascript" src="/you_module_name/static/src/js/you_module_name.js"></script>

Thanks a lot. That helped me a lot. I've created my own module to add only css and js to POS since I don't want that everywhere. And everything is working like a charm. Thanks for the guide.

GH Mediacloud, Grover Menacho
on 6/24/14, 5:37 PM

If I want to override some css in the file /home/odoo/addons/point_of_sale/static/src/css/pos.css. But when I enter in my POS, my CSS are not applied when I declare it like you. How to override CSS from the file pos.css?

Pascal Tremblay
on 2/17/15, 4:09 PM
This question has been included in the official documentation.
Gregor Heger
On 1/7/15, 1:41 AM

I haven't found this in the documentation... isn't there any easier way? Creating a whole xml with xpath inheritance sounds like too much work for adding a simple css class...


And what kind of view is this, the template tag is not familiar to me. Is this a QWeb Template? I didn't use QWeb Templates for my module - do I have to create some?

This question has been included in the official documentation.
Henrik Norlin
On 4/8/15, 12:09 PM

I thought that the template would need some extra customization, but I only had to change "you_module_name" and make sure that the path for css / js was correct. Thanks for the template!

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

7 follower(s)


Asked: 6/24/14, 11:46 AM
Seen: 13149 times
Last updated: 12/8/15, 2:24 AM