Odoo 9 inherit js file

旧城冷巷雨未停 提交于 2019-12-01 01:35:14

You can change it by overriding start function:

instance.web.WebClient.include({

    start: function() {
        this.set('title_part', {"zopenerp": "Odoo9"});
        return this._super();
    },
});

To override a javascript function in odoo, use the following code:

__openerp__.py

...
'data': [
    'module_view.xml',
],
...

module_view.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <template id="assets_backend_custum_id" name="title_365 assets" inherit_id="web.assets_backend">
            <xpath expr="." position="inside">
                <script type="text/javascript" src="/title_365/static/src/js/script.js"></script>
            </xpath>
        </template>
    </data>
</openerp>

script.js

openerp.title_365 = function(instance){
    var _t = instance.web._t,
    _lt = instance.web._lt;
    var QWeb = instance.web.qweb;

    instance.web.WebClient.include({

        start: function() {
            this.set('title_part', {"zopenerp": "Odoo9"});
            return this._super();
            },
        });
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!