I need to change title in addons/web/static/src/js/web_client.js
this.set('title_part', {"zopenerp": "Odoo"});
Is it possible in new custom module inherit js file and change "Odoo" to "Odoo 9"
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();
},
});
}
来源:https://stackoverflow.com/questions/40418642/odoo-9-inherit-js-file