Odoo在版本8中加载javascript文件? [英] Odoo loading javascript files in version 8?
问题描述
如何在版本8中加载javascript文件?在版本7中,您可以在manifesto文件中显示 js
的位置( __ openerp __。py
),如下所示: / p>
'js':['static / src / js / file.js'],
现在它不起作用。
例如我使用以下代码在我的模块中创建了js文件:
openerp.calendar_service = function(instance){
var _t = instance.web._t,
_lt = instance.web。 _lt,
QWeb = instance.web.qweb;
instance.calendar_service = {};
console.log('TEST')
};
但是使用调试器,我没有看到 TEST
已打印。如果我在某些源js文件(在其他模块中)添加此类打印,它将打印正常。那么如何加载我的js文件?
查看以下示例:
/addons/account/views/account.xml
这将向您展示如何将javascript和css文件添加到您的模块。
How do you load javascript files in version 8? In version 7, you could simply show the location of js
in manifesto file (__openerp__.py
) like this:
'js': ['static/src/js/file.js'],
Now it does not work.
For example I created js file in my module with this code:
openerp.calendar_service = function(instance) {
var _t = instance.web._t,
_lt = instance.web._lt,
QWeb = instance.web.qweb;
instance.calendar_service = {};
console.log('TEST')
};
But using debugger, I don't see that TEST
is printed. If I add such print in some source js files (in other modules), it will print it fine. So how do I make my js files load?
Check out the example shown in following:
/addons/account/views/account.xml
This will show you how to add the javascript and css files to your module.
这篇关于Odoo在版本8中加载javascript文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!