Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
3316 มุมมอง

Hi community, i tried to use my javascript file in my views but i cant.


this is my javascript file with Hello World eg. 

directory

static/src/js/test.js

odoo.define('module.models', function (require) {
​console.log("Hello World!!")
});


this is my assets in  manifest

'assets': {
'web.assets_backend': [
'module/static/src/js/test.js’]
}

but i cant use it in my views

 

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

Use javascript file in views like this:


<template id="template_id" name="template_name" inherit_id="web.assets_backtend">
            <xpath expr="." position="inside">
                <script type="text/javascript" src="js_file_path"/>
            </xpath>
</template>


Hope it helps

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ม.ค. 24
2159
2
ส.ค. 24
3372
1
เม.ย. 24
1756
0
ม.ค. 24
1031
2
ม.ค. 24
1313