Skip to Content
Menu
This question has been flagged
1 Reply
1344 Views

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();

});


Avatar
Discard
Author Best Answer

Solved, i forgot to wirte the answer before,

// Actualizar el botón del cambio de entidad
var
$parte1 = $('');
var $parte2 = $('', {text: titulo_etiqueta, class: 'o_boton_entidades'}, '');

return Promise.all([]).then(function () {
self.$('button.o_button_entidades').empty();
self.$('button.o_button_entidades').append($parte1,$parte2);
});


Avatar
Discard
Related Posts Replies Views Activity
1
Jul 24
372
0
Apr 24
352
1
Nov 24
53
0
Aug 23
905
2
Feb 23
4361