xml - 覆盖视图:website_sign/static/src/xml/website_sign_common.xml
问题描述
我试图通过扩展来改变视图。
<?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>
但它不起作用。有什么建议我应该改变什么?
解决方案
是的,你是在正确的方式。扩展视图后,您必须从 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>
愿这工作。谢谢你。
推荐阅读
- mathematical-optimization - 优化战斗机器人
- javascript - 如何更优雅地在同一方法中进行多个 Firebase 实时数据库检查?
- plot - 如何有效地将曲面图的数据从表格形式转换为一系列三元组
- python - 如何仅使用已转换为虚拟变量的变量创建新的 df?
- java - 尝试在 RecycleView Glide 中加载图像,Picasso 在适配器中不加载任何内容
- api - nuxt.js,MAMP 服务器上的 axios 响应 404
- css - 如何将带有 CSS 的 SVG clipPath 应用到 div 的一个边缘?
- algorithm - 二叉搜索树无递归或额外数据结构的按序遍历
- javascript - 有人知道我如何计算位置吗?
- azure-devops - Azure DevOps Pipeline 中的 Git 存储库权限问题