【问题标题】:Odoo 10 : How to hide import button for my custom Module?Odoo 10:如何隐藏我的自定义模块的导入按钮?
【发布时间】:2018-10-15 12:28:49
【问题描述】:

我创建了一个自定义模块,我想隐藏创建和导入按钮。直到现在我能够隐藏创建按钮,但我无法使用类似的代码隐藏我的导入按钮。以下是我的代码:

<?xml version="1.0" encoding="UTF-8"?>

<templates id="template" xml:space="preserve">

    <t t-extend="ListView.buttons">

           <t t-jquery="button.o_list_button_add" t-operation="replace">

                <t t-if="widget.model=='simcard.simcard'">

                    <button class="btn btn-sm btn-default sync_button" type="button">Sync</button>
                </t> 

           </t>

            <t t-jquery=".btn.btn-sm.btn-default.o_list_button_import" t-operation="replace">

                <t t-if="widget.model=='simcard.simcard'">


                </t>
            </t> 

    </t>

</templates>

上面的代码隐藏了创建按钮,但没有隐藏导入按钮。我可以在代码中更改什么来隐藏导入按钮?

【问题讨论】:

    标签: xml import odoo oncreate


    【解决方案1】:

    你可以这样做:

    <?xml version="1.0" encoding="UTF-8"?>
    <templates id="template" xml:space="preserve">
        <t t-extend="ListView.buttons">
            <t t-jquery="button.o_list_button_add" t-operation="before">
                <t t-if="widget.model=='simcard.simcard'">
                    <t t-set="widget.options.addable" t-value="false"/>
                    <t t-set="widget.options.import_enabled" t-value="false"/>
                    <button class="btn btn-sm btn-default sync_button" type="button">Sync</button>
                </t>
            </t>
        </t>
    </templates>
    

    【讨论】:

    • 它创建了一个新按钮'false'
    • 这样你就有了解决方案的想法。为有用的答案投票是有礼貌的
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-25
    • 1970-01-01
    相关资源
    最近更新 更多