콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
7938 화면

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.

아바타
취소
관련 게시물 답글 화면 활동
1
4월 20
7899
2
2월 24
15063
0
4월 22
2599
4
3월 22
17441
4
10월 21
6736