Search code examples
csslessodooodoo-9

How to arrange css priority in ODOO, when installing modules?


Odoo version: 9 community

I defined style for "#o_shop_collapse_category li a" but, it's not loading last, the style loaded is the one defined in "/website_sale/static/src/css/website_sale.css".

When I defined my module, it depends of website_sale, so.... my module is installed last, and the css file is defined with last() so my style should be last defined in the website.assets_frontend.0.css

My style is the following:

#o_shop_collapse_category li a{
    border: 1px solid #ccc;
    padding: 6px 4px 6px 20px;
    margin-bottom: 5px;
}

and it is load like this

<template id="celuphone_style" name="Celuphone style" inherit_id="website.assets_frontend">
    <xpath expr="link[last()]" position="after">
        <link rel="stylesheet" href="/client_CELUPHONE/static/less/style.less" type="text/less"/>
    </xpath>
</template>

The question is how Odoo define modules priorities at the time to compile less files

Thanks!


Solution

  • Maybe you should just add priority to template definition?

    <template id="celuphone_style" name="Celuphone style" inherit_id="website.assets_frontend" priority="999">
        <xpath expr="link[last()]" position="after">
            <link rel="stylesheet" href="/client_CELUPHONE/static/less/style.less" type="text/less"/>
        </xpath>
    </template>