Search code examples
xmlodooodoo-11erp

Add button after import button odoo 11


everone. I was try to add a button after the import button. I was try like this :

<?xml version="1.0" encoding="UTF-8"?>
<templates>
    <t t-extend="ListView.buttons">
        <t t-jquery="button.oe_form_button_create" t-operation="after" >
            <button name="button_import" type="button" t-if='widget.modelName == "my.model"' class="btn btn-sm btn-default o_import_button o_import_import">Upload</button>
        </t>
    </t>
</templates>

And yes, it's working. the button is diplayed after the button create, but i want put the button after import button.


Solution

  • Button import is located in this template:

     <t t-name="ImportView.import_button">
            <button t-if='widget.options.import_enabled' type="button" class="btn btn-sm btn-default o_button_import">
                Import
            </button>
        </t>
    

    witch is located in the base_import module.

    Just extend it this will make your button appear in the list and kanban view, remember to add dependency on the base_import module

    <t t-extend="ImportView.import_button">
        <t t-jquery="button.o_button_import" t-operation="after" >
            <button name="button_import" type="button" t-if='widget.modelName == "my.model"' class="btn btn-sm btn-default o_import_button o_import_import">Upload</button>
        </t>
    </t>