覆盖视图:website_sign / static / src / xml / website_sign_common.xml

问题描述 投票:0回答:1

我试图通过扩展它来改变视图。

<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
    <div t-extend="website_sign.thank_you_dialog">
        <div t-jquery=".row o_promote_esign" t-operation="replace">
            <div class="row o_promote_esign">
            <div class="col-md-2">
                <img src="/website_sign/static/description/icon.png" alt="Document Sign" class="img img-responsive"/>
            </div>
            <div class="col-md-10">
                <h4>Do you also send documents to sign?</h4>
                It's easy, incredibly efficient and totally free: you just have to create an account.
            </div>
        </div>
        </div>
    </div>
</templates>

但它没有用。任何建议我应该改变什么?

xml odoo-11
1个回答
0
投票

是的,你的方式正确。扩展视图后,您必须从js加载模板文件,如下所示:

    odoo.define('module_nm.js_nm', function (require) {
       'use strict';

        var core = require('web.core');
        var ajax = require('web.ajax');
        var qweb = core.qweb;
        var test = require('base_module_js_nm');

        test.include({   
           _loadTemplates: function(){                                
             return $.when(this._super(), 
           ajax.loadXML('/module_nm/static/src/xml/file_nm.xml', qweb))         
            },          
       });
    });

然后,您必须在assets.xml文件中添加此js文件,如下所示:

<template id="tmpl_id" inherit_id="web.assets_frontend" name="Template name">        
    <xpath expr="//script[last()]" position="after">            
          <script type="text/javascript" 
                src="/module_nm/static/src/js/js_file_nm.js"></script>            
    </xpath>
</template>

愿这个工作。谢谢。

© www.soinside.com 2019 - 2024. All rights reserved.