Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
10120 Vistas

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
Descartar
Mejor respuesta

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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
0
ene 19
8247
0
dic 17
3990
1
jun 24
1212
1
oct 23
1823
1
ago 22
48