跳至內容
選單
此問題已被標幟
2 回覆
5806 瀏覽次數

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
2641
1
2月 18
3789
0
3月 15
4271
0
4月 25
753
2
6月 23
42532