Skip to Content
Menu
This question has been flagged
1 Atsakyti
2970 Rodiniai

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

 

Portretas
Atmesti
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

Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
0
saus. 24
1932
2
rugp. 24
3159
1
bal. 24
1517
0
saus. 24
842
2
saus. 24
1143