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

I have some customization in search field in Odoo 10..

I did changes in  svnodoo10\addons\web\static\src\js\widgets\auto_complete.js

Original Code:

odoo.define('web.AutoComplete', function (require) {

"use strict";

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

return Widget.extend({

    template: "SearchView.autocomplete",

render_search_results: function (results) {

   var self = this;

  // this._super();

   var $list = this.$el;

   $list.empty();

   results.forEach(function (result) {

       var $item = self.make_list_item(result).appendTo($list);

       result.$el = $item;

   });

   this.show();

    // My customization

   if(this.history)

   {

                   var $first_list = self.$('li:first-child');

   }

       //End

},

});


Extended auto_complete_history.js

odoo.define('product.auto_complete_history', function (require) {

"use strict";  

var AutoComplete = require('SearchView.autocomplete');

return AutoComplete.extend({

     template: "SearchView.autocomplete",

    render_search_results: function (results) {

               this._super();

             if(this.history)

   { 

       var $first_list = self.$('li:first-child');

   }

},

});

});


But extended file doesnt override the code.

Please anyone help to us how to extend this file.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

I think that you could do it like this:

odoo.define('product.auto_complete_history', function (require) {
"use strict";  
var AutoComplete = require('SearchView.autocomplete');
AutoComplete.include({
    template: "SearchView.autocomplete",
   render_search_results: function (results) {
    this._super();
        if(this.history){ 
        var $first_list = self.$('li:first-child');
    }
}
});
});


s

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ม.ค. 19
8240
0
ธ.ค. 17
3978
1
มิ.ย. 24
1210
1
ต.ค. 23
1816
1
ส.ค. 22
48