1

I'm trying to customize the basic Field object on the web client. Here's my code:

openerp.web_mymodule = function(openerp) {

    openerp.web.form.Field = openerp.web.form.Field.extend({
        init: function(view, node) {
            console.log('mine');
            this._super(view, node);
        }
    });
    [...]

}

but is not working. AFAIK this should work as well as the following code (in the same file) is working:

[...]
openerp.web.form.FieldChar = openerp.web.form.FieldChar.extend({

    init: function (view, node) {
        this._super(view, node);
        console.log('mine')
    }

});

The only difference I can see is that all the widgets, FieldChar included, are registered in view_form.js whilst Field is not.

Am I missing some "black magic" behind this? tnx

simahawk
  • 2,421
  • 1
  • 16
  • 22

1 Answers1

2

Did you try using include instead of extend?

openerp.web_mymodule = function(openerp) {

    openerp.web.form.Field.include({
        init: function(view, node) {
            console.log('mine');
            this._super(view, node);
        }
    });
    [...]
}

xmo wrote an explanation here: openerp web client 6.1: how to override base javascript functions

Community
  • 1
  • 1
  • I was just trying the same and indeed it works :) I just re-read xmo answer to me (!!) but still I find it a bit strange since acting on 'real instances' of the Field obj like FieldChar and alike works :S Anyway tnx! :) – simahawk Aug 14 '12 at 13:38