Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
11337 Widoki

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  

Awatar
Odrzuć

shared the error message along with the post

Najlepsza odpowiedź

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

Awatar
Odrzuć
Autor Najlepsza odpowiedź

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’]
}




Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
gru 24
6168
1
sie 25
359
1
sie 25
344
4
lip 25
1688
1
lip 25
959