Search code examples
odoofaviconopenerp-8

How do I set favicon in Odoo / OpenERP?


How do I set a favicon for the web/e-commerce frontend of Odoo 8?

Ideally without changing Odoo core files, i.e. I do not simply want to overwrite addons/web/static/src/img/favicon.ico.

(This is Odoo 8, August 2014. It's likely that it will be easier to change the favicon in future versions.)


Solution

  • You have to override the web module with your own module. You can add a line like

    'data': [ 'views/website_templates.xml' ]
    

    in your __openerp__.py.

    Put your favicon at static/src/img/favicon.ico and add a template to views/website_templates:

    <template id="MYSITE_layout" inherit_id="website.layout" name="MYSITE layout" priority="17">
        <xpath expr="//head//link" position="after">
            <link rel="shortcut icon" href="/MYSITE_web/static/src/img/favicon.ico" type="image/x-icon"/>
        </xpath>
    </template>