STEP 1: INHERIT THE TREE VIEW QWEB TEMPLATE
Define a xml file : static/src/xml/template.xml
<t t-extend="ListView.buttons">
<t t-jquery="button.o_list_button_add" t-operation="after">
<button t-if='widget' type="button" class="btn btn-secondary o_button_to_call_wizard">
Import
</button>
</t>
</t>
STEP 2: INHERIT THE LIST CONTROLLER JS
Define a js file : static/src/js/list_controller.js
odoo.define('your_module_folder.JsToCallWizard', function (require) {
"use strict";
var ListController = require('web.ListController');
var JsTocallWizard = ListController.include({
renderButtons: function($node){
this._super.apply(this, arguments);
if (this.$buttons) {
this.$buttons.on('click', '.o_button_to_call_wizard', this.action_to_call_wizard.bind(this));
this.$buttons.appendTo($node);
}
},
action_to_call_wzard: function(event) {
event.preventDefault();
var self = this;
self.do_action({
name: "Open a wizard",
type: 'ir.actions.act_window',
res_model: 'my.wizard.model.name',
view_mode: 'form',
view_type: 'form',
views: [[false, 'form']],
target: 'new',
});
},
});
});
STEP 3 : ADD YOUR JS FILE IN ASSETS BACKEND
XML File : views/assets_backend.xml
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<template id="assets_backend" inherit_id="web.assets_backend" name="Backend Assets">
<xpath expr="//script[last()]" position="after">
<script src="/your_module_folder/static/src/js/list_controller.js"></script>
</xpath>
</template>
</odoo>
STEP 3: DECLARE YOUR FILES IN MANIFEST
'data': ['views/assets_backend.xml'],
'qweb': ['static/src/xml/template.xml'],