Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

126
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!