콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
5788 화면

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

아바타
취소
베스트 답변

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 = {
    ...
}
아바타
취소

I just tried this but it doesnt work

작성자

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

}

});

작성자 베스트 답변

Hi Axel,

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

아바타
취소
관련 게시물 답글 화면 활동
1
4월 19
2636
1
2월 18
3780
0
3월 15
4261
0
4월 25
732
2
6월 23
42527