Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
5794 Weergaven

I need to inherit "get_search_result"  with in form_common.js file. so i used the below method to inherit but it doesn't works..


var form_common = require('web.form_common');

form_common.CompletionFieldMixin.include({

get_search_result: function(search_val) {

         .....

         .....

          },

});


can anyone help me to inherit this method.. ASAP

Avatar
Annuleer
Beste antwoord

Hi selvi

You could do it like:

var form_common = require('web.form_common');
var original_get_search_result = form_common.CompletionFieldMixin.get_search_result;
form_common.CompletionFieldMixin.get_search_result = function(search_val) {
    //call the original function if you need too like:
    //original_get_search_result(search_val);
    ... rest of the code
};

This way of extend it is because the CompletionFieldMixin is an Object created like

var CompletionFieldMixin = {
    ...
}
Avatar
Annuleer

I just tried this but it doesnt work

Auteur

I resolved this issue..

Have to do this like:

var FieldMany2One = core.form_widget_registry.get('many2one');

FieldMany2One.include({

get_search_result: function (search_val) {

........

........ // rest of the code

}

});

Auteur Beste antwoord

Hi Axel,

I tried your code but it doesn't seems work..

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
1
apr. 19
2636
1
feb. 18
3783
0
mrt. 15
4263
0
apr. 25
742
2
jun. 23
42530