Thursday, 24 September 2015

How to add a custom css? | Odoo

What is the best way to add custom css to openerp 7 without modifying any original file of openerp?



Just create a module and add your css file in __openerp__.py as below.



# __openerp__.py
 {  
   'name': "CSS Example",     'description': "new css example",     'category': 'Generic Modules/Others',     'depends': ['web'],     'data': [],     'css': ['static/src/css/my_css.css'], 
}

<?xml version="1.0" encoding="utf-8"?>
<!-- vim:fdn=3:
-->
<openerp>
    <data>
        <template id="custom_assets_backend" name="custom assets" inherit_id="web.assets_backend">
            <xpath expr="." position="inside">
                <script type="text/javascript" src="modulename/static/src/js/my_js.js"></script>
            </xpath>
        </template>
    </data>
 </openerp>


What is the best way to add custom css and js to odoo ?
Just create a module and add your css file and js file in views/custom_view.xml as below.
<link rel="stylesheet" href="modulename/static/src/css/my_css.css"/>