2017-02-06 15 views
0

テンプレートbase_importにデモファイルをダウンロードするためのリンクを追加します。odooのクライアント側のテンプレート継承10

<t t-name="ImportView"> 
    <t t-set="_id" t-value="_.uniqueId('export')"/> 
    <form action="" method="post" enctype="multipart/form-data" class="oe_import"> 
     <input type="hidden" name="csrf_token" t-att-value="csrf_token"/> 
     <input type="hidden" name="session_id" 
      t-att-value="widget.session.session_id"/> 
     <input type="hidden" name="import_id"/> 
     <div class="oe_import_box col-sm-9"> 
      <div class="col-sm-12"> 
       <p>Select a CSV or Excel file to import. <a href="https://www.odoo.com/documentation/user/10.0/general/base_import/import_faq.html" target="new" class="pull-right">Help</a></p> 
      </div> 
      <div class="col-sm-10"> 
       <div class="input-group"> 
        <input type="text" class="oe_import_file_show form-control" placeholder="No file chosen..."/> 
        <span class="input-group-btn"> 
        <label class="btn btn-primary" for="my-file-selector"> 
        <input accept=".csv, .xls, .xlsx, .ods" id-attf-id="file_#{_id}" 
        name="file" id="my-file-selector" class="oe_import_file" type="file" style="display:none;"/> 
        Load File 
        </label> 
        </span> 
        <span class="input-group-btn"> 
        <button type="button" class="btn btn-default oe_import_file_reload" disabled="disabled">Reload File</button> 
        </span> 
       </div> 
      </div> 
      <!-- More code --> 
     </div> 
    </form> 
</t> 

私は、リンクの追加のために書くコードです::以下のショーのように元のテンプレートがそれです

<t t-name="BaseImportCustom" t-extend="ImportView"> 
    <t t-jquery="form.oe_import" t-operation="append"> 
     <p><a href="https://path-to-file" target="new" class="pull-right">Download Demo</a></p> 
    </t> 
</t> 

が、これは動作しないので、誰かが知っている、リンクが表示されませんか?あるいは、この

答えて

0
  1. まず、あなたがダブルチェックxmlファイルが既にあなたの新しいモジュールの__manifest__.pyで宣言された可能性がない場合の別の方法を存在する場合は?
  2. 第2に、t-name="BaseImportCustom"を拡張ビューに追加しないでください。この問題はt-name="BaseImportCustom"から発生すると考えられます。Odooのすべてのxmlファイルをキー "t-extend"で検索して、"t-extend""t-name"となります。私は
<t t-extend="ImportView"> 
    <t t-jquery="form.oe_import" t-operation="append"> 
     <p><a href="https://path-to-file" target="new" class="pull-right">Download Demo</a></p> 
    </t> 
</t> 
(まだテストしていない)、これはOKであると思います
関連する問題