跳至内容
菜单
此问题已终结
2 回复
10055 查看

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  

形象
丢弃

shared the error message along with the post

最佳答案

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

形象
丢弃
编写者 最佳答案

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




形象
丢弃
相关帖文 回复 查看 活动
2
12月 24
4136
2
6月 25
358
1
5月 25
96
0
5月 25
469
1
5月 25
661