コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
2838 ビュー

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
1859
2
8月 24
3017
1
4月 24
1418
0
1月 24
785
2
1月 24
1039