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

Hello,

In odoo how js files, css files, views & template are related to each other. I have check other module for same but got confused. can any one please explain with example.

Thanks in advance.

อวตาร
ละทิ้ง

https://www.odoo.com/documentation/13.0/ Have a look here and better to learn from there.

คำตอบที่ดีที่สุด

Hi SSS,

Consider Following Files  dashoboard.js(JS File), dashboard.css (CSS File), dashboard_template.xml(Template File), dashboard_view.xml(View File)

First of all you need to define View and Template File in Manifest like below code

{
    'name': "Dashboard",
    'version': '1.0',
    'depends': ['base', 'web'],
    'data': [
        'view/dashboard_view.xml',
        ],
    'qweb': [
        'static/src/xml/dashboard_template.xml',
        ],
    'installable': True,
    'auto_install': True,
    'application': True
}

You need to define css and Js files in dashboard_view File like below

<template id="dashboard_assets" name="dashboard_files" inherit_id="web.assets_backend">
        <xpath expr="." position="inside">
                <link rel="stylesheet" href="/project_name/static/src/css/dashboard.css"/>
                <script type="text/javascript" src="/project_name/static/src/js/dashboard.js"/>
        </xpath>
</template>

Thanks.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
How to render mail.template ? แก้ไขแล้ว
1
เม.ย. 20
7899
2
ก.พ. 24
15055
0
เม.ย. 22
2597
Creating a new view TYPE from scratch. แก้ไขแล้ว
4
มี.ค. 22
17436
4
ต.ค. 21
6731