首页 文章

odoo 10中客户端的模板继承

提问于
浏览
0

我想在模板base_import中添加一个下载演示文件的链接 . 原始模板如下所示:

<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>

但这没有显示链接,有人知道,因为不工作?或者如果存在另一种方式

1 回答

  • 1
    • 首先,您是否可以仔细检查 xml 文件是否已在新模块的 __manifest__.py 中声明?

    • 其次,您不应在扩展视图中添加 t-name="BaseImportCustom" ,我相信问题来自 t-name="BaseImportCustom" ,您可以使用密钥"t-extend"搜索Odoo中的所有xml文件,并注意_729399_不存在 "t-extend" 的情况 . 我希望这没关系(还没测试)

    <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">下载演示</a> </ p> </ T> </ T>

相关问题