Odoo在版本8中加载javascript文件? [英] Odoo loading javascript files in version 8?

查看:89
本文介绍了Odoo在版本8中加载javascript文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在版本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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆