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

Thanks for downvote @Dr Obx!

작성자

@Dr Obx, any suggestions to improve this Q/A? What you do not like exactly? Please share your thoughts with us

작성자 베스트 답변

1. Store files correctly:

CSS and JS files should be reside under 'static' directory in the module(the rest of subdirectory tree under 'static' is an optional convention):

  • static/src/css/your_file.css
  • static/src/js/your_file.js

2. Add files in manifest (v7.0) or in XML(v8.0)

  • Openerp v7.0 way is to add following entries in manifest (in __openerp__.py):
    ...
    'css': ['static/src/css/your_file.css'],
    'js': [static/src/js/your_file.js'],
    ...
  • Odoo v8.0 way is to add corresponding record in the XML:
    • ​Add XML to the manifest (__openerp__.py):
      ...
      'data': [ 'your_file.xml'],
      ​...
    • Then add following record in 'your_file.xml':
      <openerp>
          <data>
              <template id="assets_backend" name="your_module_name assets" inherit_id="web.assets_backend">
                  <xpath expr="." position="inside">
                      <link rel='stylesheet' href="/your_module_name/static/src/css/your_file.css"/>
                      <script type="text/javascript" src="/your_module_name/static/src/js/your_file.js"></script>
                  </xpath>
              </template>
          ....
          ....
          </data>
       </openerp>
아바타
취소
작성자

With the similar way, we can add css/js to the public website, for doing so, we use

inherit_id="website.assets_frontend"
instead of
inherit_id="web.assets_backend"
replacing "assets_backend" with "assets_frontend" and "web" with "website"...
관련 게시물 답글 화면 활동
1
5월 25
7743
1
11월 24
4168
0
5월 24
1528
1
4월 24
1677
0
8월 21
8658