Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
5809 มุมมอง

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..

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
เม.ย. 19
2642
1
ก.พ. 18
3791
0
มี.ค. 15
4272
0
เม.ย. 25
761
2
มิ.ย. 23
42535