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

how can i use css and js in template called by controller odoo 15

i try using

inherit_id

website.assets_common but it seem doesnt work and i got error External Id not found .

I already add depends web

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

From v15 onwards, adding the assets have been changed and has been moved into the manifest.

Before v15, we were used to inheriting the asset in the XML and adding our custom assets.

But from v15, the asset definition has been moved into the __manfiest__.py of the module as shown below:

'assets': {
    'web.assets_backend': [
        'web/static/src/xml/**/*',
    ],
    'web.assets_common': [
        'web/static/lib/bootstrap/**/*',
        'web/static/src/js/boot.js',
        'web/static/src/js/webclient.js',
    ],
    'web.qunit_suite_tests': [
        'web/static/src/js/webclient_tests.js',
    ],
},

Check assets documentation for more information.


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

hi

for css & js use inherit_id="web.assets_backend"

in website 'user interface' you can use inherit_id='web.assets_frontend'

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
CSS file doesn´t load in template แก้ไขแล้ว
2
พ.ค. 20
6989
0
มี.ค. 17
3442
3
ธ.ค. 24
21421
0
ส.ค. 20
4235
1
ธ.ค. 19
5675