Reputation: 195
i want to hide the create and import button in the header of my treeview my Odoo version is odoo11
I tried using the inserting create="false" edit="false"
in my treeview tag but it hides all the button and I also tried replacing the t-operation="after"
to t-operation="replace"
but it affects all the other application
<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>
I only want to hide the "Create" and "Import" button in that specific treeview thank you
Upvotes: 1
Views: 1614
Reputation: 14721
Try this code to remove the create button:
<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>
And to remove the import button for this model:
<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>
Upvotes: 3