Hello, please can you help me? How I can custom a new button to my Module in Odoo11? I created the files: boton.xml what contains:
<template xml:space="preserve">
<t t-extend="ListView.buttons">
<t t-jquery="button.o_list_button_add" t-operation="after">
<button t-if="widget.modelName == 'e.retenciones'" type="button" class="btn btn-primary btn-sm oe_importa_button" accesskey="f">
Import from .txt file
</button>
</t>
</t>
</template>
also, I have the javascript file that I would like to upload a txt file and then (later) using Python read the file and execute some functions:
odoo.define('whatever.importa_button', function (require) {
"use strict";
var core = require('web.core');
var ListController = require('web.ListController');
ListController.include({
renderButtons: function($node) {
this._super.apply(this, arguments);
if (this.$buttons) {
let importa_button = this.$buttons.find('.oe_importa_button');
importa_button && importa_button.click(this.proxy('importa_button')) ;
}
},
importa_button: function () {
console.log('If you can see this, you're almost close to conquer the world')
//Here I would like to call a custom form to upload a txt file
}
});
})
When I installed the application I saw the new button after New/Create button; but it still doesn't work in spite of set the manifest file to call two files (above). Also I don't know where I have to put the code to call a custom form when user press the button.
I don't know what happened or if I forget to set something. I hope you can help me. Thanks.