Odoo 9 inherit js file

后端 未结 1 879
我在风中等你
我在风中等你 2021-01-07 02:59

I need to change title in addons/web/static/src/js/web_client.js

this.set(\'title_part\', {\"zopenerp\": \"Odoo\"});

Is it

相关标签:
1条回答
  • 2021-01-07 03:30

    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();
                },
            });
    }
    
    0 讨论(0)
提交回复
热议问题