Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
10116 Visualizzazioni

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.

Avatar
Abbandona
Risposta migliore

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

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
0
gen 19
8243
0
dic 17
3981
1
giu 24
1211
1
ott 23
1819
1
ago 22
48