仅在 odoo11 中隐藏特定模块中的 "Create" 按钮

Hide the "Create" Button in a specific module only in odoo11

我想在树视图的 header 中隐藏创建和导入按钮我的 Odoo 版本是 odoo11

我尝试在树视图标签中使用插​​入 create="false" edit="false",但它隐藏了所有按钮,我还尝试将 t-operation="after" 替换为 t-operation="replace",但它会影响所有其他应用程序

<template xml:space="preserve">
        <t t-extend="ListView.buttons">
            <t  t-jquery="button.o_list_button_add" t-operation="replace">
                <button t-if="widget.modelName == 'hr.timeinout'" type="button" class="btn btn-primary btn-sm oe_refresh_button" accesskey="f">
                    Refresh List
                </button> 
            </t>
        </t>
</template>

我只想隐藏特定树视图中的 "Create" 和 "Import" 按钮谢谢

尝试使用此代码删除创建按钮:

    <t t-extend="ListView.buttons">
        <!-- this will hide create button for model  'hr.timeinout' -->
        <t  t-jquery="button.o_list_button_add" t-operation="attributes">
            <attribute name="t-if">widget.modelName != 'hr.timeinout'</attribute>
        </t>

        <!-- this will add refresh button for model  'hr.timeinout' -->
        <t  t-jquery="div.o_list_buttons" t-operation="prepend">
            <button t-if="widget.modelName == 'hr.timeinout'" type="button" class="btn btn-primary oe_refresh_button" accesskey="f">
                Refresh List
            </button>
        </t>

    </t>

并删除此模型的导入按钮:

    <t t-extend="ImportView.import_button">
        <!-- this will remove button import for model  'hr.timeinout' -->
        <t  t-jquery="button.o_button_import" t-operation="attributes">
            <attribute name="t-if">widget.modelName != 'hr.timeinout'</attribute>
        </t>
    </t>