Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
1 Responder
2761 Visualizações

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
Cancelar
Melhor resposta

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
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
0
jan. 24
1765
2
ago. 24
2883
1
abr. 24
1318
0
jan. 24
745
2
jan. 24
957