Skip to Content
Menu
This question has been flagged
2 Replies
9633 Views

this is my manifest code:

"assets": {"web.assets_backend": ["test/static/src/js/prueba.js",        ]    },


 my view:

<odoo><templateid="assets backend"name="test assets backend"><xpathexpr="."position="inside"><scripttype="text/javascript"src="/test/static/src/js/prueba.js"/>xpath>template>odoo>


and this is my javascript file: dir static/src/js/test.js

  odoo.define("test.script", function (require) {"use strict";
console.log("Hello world");});


a get an error  

Avatar
Discard

shared the error message along with the post

Best Answer

Hi,

You can add your javascript file under module_name -> static -> src-> js folder.

you can code as like following 

odoo.define('module_name.models', function (require) {

});

and you can load the js file in the manifest

'assets': {
'web.assets_backend': [
'module_name/static/src/js/file_name.js’]
}

check this references for js file

https://www.odoo.com/documentation/16.0/developer/reference/frontend/javascript_modules.html

Hope it helps

Avatar
Discard
Author Best Answer

i tried, but dosnt work, this is my code.

'assets': {

'circulacion.assets': [

'circulacion/static/src/js/assets.js',

            ],

        },


this is my js code

the directory is static/src/js and its name assets.js

  odoo.define('circulacion.campo_nit', function (require) {

"use strict";

console.log("Custom JavaScript In Circulación");

});


Also tried with this

'assets': {
​'web.assets_backend': [
​'circulacion/static/src/js/asstes.js’]
}




Avatar
Discard
Related Posts Replies Views Activity
2
Dec 24
3260
0
May 25
123
1
May 25
299
1
May 25
388
0
Apr 25
2