我试图通过扩展视图来更改视图。
<?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>
但是它不起作用。有什么建议我应该改变什么?
答案 0 :(得分: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))
},
});
});
然后,您必须将此js文件添加到assets.xml文件中,如下所示:
<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>
可以的。谢谢。