I want to remove Create and Import button in my module and replace it with Sync button.I tried below code :
<?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>
This adds 'false' button next to my Sync button. Then i tried below solution which doesnt remove the Create button but removes the Import button :
<?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="after">
<t t-if="widget.model=='simcard_piavita.simcard_piavita'">
<button class="btn btn-sm btn-default sync_button" type="button">Sync</button>
<t t-set="widget.options.addable" t-value="false"/>
<t t-set="widget.options.import_enabled" t-value="false"/>
</t>
</t>
</t>
</templates>
Then i tried below solution :
<?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_piavita.simcard_piavita'">
<button class="btn btn-sm btn-default sync_button" type="button">Sync</button>
<t t-set="widget.options.addable" t-value="false"/>
<t t-set="widget.options.import_enabled" t-value="false"/>
</t>
</t>
</t>
</templates>
It removes the Create button from other installed modules as well. Is there a perfect way to remove the Create button and keep the Sync button in my module?