javascript - 如何在保存模式下打开向导操作还隐藏编辑、创建、保存和丢弃按钮 Odoo11
问题描述
当我单击按钮时,向导会以“编辑”模式打开。我想在“保存”模式下打开向导也想隐藏按钮页脚(创建、编辑、保存和丢弃)。那么,有人建议我解决这个问题吗?
我的代码如下:
o_button_help: function(){
var self = this;
event.stopPropagation();
event.preventDefault();
rpc.query({
model: 'timesheet.help',
method: 'get_timesheet_help_document',
args: [],
}).then(function (res) {
test = res['timesheet_document_view_id'];
self.do_action({
name: ("Help"),
type: 'ir.actions.act_window',
res_model: 'document.document',
view_mode: 'form,tree,kanban',
view_type: 'form',
views: [[false, 'form'],[false, 'list'],[false, 'kanban']],
target: 'new',
res_id: test,
},{on_reverse_breadcrumb: function(){ return self.reload();}})
});
解决方案
通过在操作中应用标志并通过 jquery 隐藏按钮解决了问题:
o_button_help: function(){
var self = this;
event.stopPropagation();
event.preventDefault();
rpc.query({
model: 'timesheet.help',
method: 'get_timesheet_help_document',
args: [],
}).then(function (res) {
test = res['timesheet_document_view_id'];
self.do_action({
name: ("Help"),
type: 'ir.actions.act_window',
res_model: 'document.document',
view_mode: 'form,tree,kanban',
view_type: 'form',
views: [[false, 'form'],[false, 'list'],[false, 'kanban']],
target: 'new',
res_id: test,
flags: {'form': {'mode': 'readonly', 'initial_mode': 'readonly'}},
},{on_reverse_breadcrumb: function(){ return self.reload();}})
});
<form class="o_form_document">
<script>
$(document).ready(function(){
$(".modal-header").hide();
$(".modal-footer").hide();
});
</script>
...
</form>
谢谢大家。
推荐阅读
- android - 如何显示字符串键而不是值(整个应用程序)
- android - 某些谷歌个人资料图片照片上的 h4 googleusercontent 404 错误
- java - DSSException:吊销数据丢失
- git - Git克隆致命
- android - 使用 hide() 函数后 FloatingActionButton 图标消失
- variables - SCSS / SASS:如何在每个循环中创建变量
- python - 在 python 中反序列化 JSON 字符串的模式
- python - 由于用户输入无效,如何重新启动 python 程序
- mysql - 使用 SQL REGEXP 忽略数字并仅获取 String 和 '/'
- python-3.x - 如何让声音文件在两个不同的设备上播放?