Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

125
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda