openerp(odoo)8中css、js加载问题

来源:互联网 发布:java伪装ip发起请求 编辑:程序博客网 时间:2024/04/29 21:47

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: 

<pre><?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <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>
            </xpath>
        </template>
    </data>

</openerp></pre>


转自:https://www.odoo.com/forum/help-1/question/how-css-and-js-inheritance-works-on-odoo-v8-55278

0 0