我需要在addons/web/static/src/js/web_client.js
this.set('title_part', {"zopenerp": "Odoo"});
是否有可能在新的自定义模块中继承js文件并更改" Odoo"到" Odoo 9"
答案 0 :(得分:4)
您可以通过覆盖start
功能来更改它:
instance.web.WebClient.include({
start: function() {
this.set('title_part', {"zopenerp": "Odoo9"});
return this._super();
},
});
要覆盖odoo中的javascript函数,请使用以下代码:
__ 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();
},
});
}