Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
9983 Visualizzazioni

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
Abbandona

shared the error message along with the post

Risposta migliore

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
Abbandona
Autore Risposta migliore

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
2
dic 24
4003
1
mag 25
94
0
mag 25
401
1
mag 25
593
1
mag 25
706