Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
3286 Zobrazení

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

 

Avatar
Zrušit
Nejlepší odpověď

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

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
0
led 24
2130
2
srp 24
3346
1
dub 24
1704
0
led 24
1000
2
led 24
1303