Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
3465 Prikazi

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
Opusti
Best Answer

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
Opusti
Related Posts Odgovori Prikazi Aktivnost
0
jan. 24
2236
2
avg. 24
3491
1
apr. 24
1868
0
jan. 24
1099
2
jan. 24
1388