I need to change the text of button that's in the sysTray area, this is my JS code
odoo.define('custom.systray', function (require) {
"use strict";
var SystrayMenu = require('web.SystrayMenu');
var Widget = require('web.Widget');
var Rpc = require('web.rpc');
var Core = require('web.core');
var Session = require('web.session')
var ListView = require('web.ListView');
var ListController = require("web.ListController");
var Model = require("web.Model");
var view_dialogs = require('web.view_dialogs');
var titulo_etiqueta = "Choose Entity"
function inicializar() {
var self = this;
var systemTrayMenuEntidades = Widget.extend({
label: titulo_etiqueta,
template: 'systray.menu.entidad',
events: {
"click": 'on_click',
},
on_click: function (event) {
new view_dialogs.SelectCreateDialog(this, {
res_model: 'entidades',
title: 'Choose entity',
no_create: true,
disable_multiple_selection: true,
on_selected: function (records) {
var record_ids = records.map(function(item){
return item['id'];
});
console.log(record_ids[0])
var etiqueta = Rpc.query({
model: "entidades",
method: 'search_read',
domain: [['id','=',record_ids[0]]],
})
.then(function (id_entidad) {
console.log('************ Get data %s ************', id_entidad[0].name)
titulo_etiqueta = id_entidad[0].name
});
console.log(records)
}
}).open();
}
});
SystrayMenu.Items.push(systemTrayMenuEntidades);
}
inicializar();
});