Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

121
Visualizações
extend Widget's init method in odoo 13

I'm trying to extend the widget's init method to make a simple console.log when the page is loaded, but it doesn't work, what can be a correct way to do this?

odoo.define('lliege_pdt_main.pdt_maps', function (require) {
    var Widget = require('web.Widget');

    var pdt_maps = Widget.extend({
        init: function (parent) {
            console.log("test");
            this._super(parent);
        },
    });
    return pdt_maps;
});
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

In your case you do not want to inherit the widget in the classical sense. You want to modify the parent itself. This can be done with include instead of extend:

var pdt_maps = Widget.include({
        init: function (parent) {
            console.log("test");
            this._super(parent);
        },
});

Don't forget to debug in assets debug (gorilla) mode. Here is the official documentation on patching a JS class like this.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda