跳至内容
菜单
此问题已终结
1 回复
3528 查看

Hi community, i tried to use my javascript file in my views but i cant.


this is my javascript file with Hello World eg. 

directory

static/src/js/test.js

odoo.define('module.models', function (require) {
​console.log("Hello World!!")
});


this is my assets in  manifest

'assets': {
'web.assets_backend': [
'module/static/src/js/test.js’]
}

but i cant use it in my views

 

形象
丢弃
最佳答案

Hi,

Use javascript file in views like this:


<template id="template_id" name="template_name" inherit_id="web.assets_backtend">
            <xpath expr="." position="inside">
                <script type="text/javascript" src="js_file_path"/>
            </xpath>
</template>


Hope it helps

形象
丢弃
相关帖文 回复 查看 活动
0
1月 24
2291
2
8月 24
3531
1
4月 24
1924
0
1月 24
1131
2
1月 24
1426