javascript - 如何在保存模式下打开向导操作也隐藏编辑、创建、保存和丢弃按钮 Odoo 11

标签 javascript save odoo odoo-11

当我点击按钮时,向导会以“编辑”模式打开。我想在“保存”模式下打开向导也想隐藏按钮页脚(创建、编辑、保存和丢弃)。那么,有人建议我解决这个问题吗?

我的代码如下:

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();}})
    });

另附截图: enter image description here 提前致谢

最佳答案

通过在操作中应用标志并通过 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>

感谢大家。

关于javascript - 如何在保存模式下打开向导操作也隐藏编辑、创建、保存和丢弃按钮 Odoo 11,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57050853/

相关文章:

javascript - 可以在 Javascript 中生成加密强度高的 UUID 吗?

excel - 工作簿.save - "the following features cannot be saved in macro-free workbooks..."

python - 从另一个类访问对象

drop-down-menu - 从员工的操作下拉列表中删除 "Duplicate"

javascript - 如果你添加一个类似 facebook 的按钮,定时器每 100 毫秒触发一次

javascript - 检查菜单链接是否有子菜单 JavaScript

javascript - 点击带有数据集的按钮,会出现具有相同数据集的div

r - 相当快地保存非常大的 R 数据帧

当我在真正的三星 galaxy s3 上拍照时 Android 崩溃

python - 如何消除odoo采购订单产品线中的重复产品?