تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
10839 أدوات العرض

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
ديسمبر 24
5386
2
يوليو 25
232
2
يوليو 25
979
4
يوليو 25
827
1
يوليو 25
111