[IMP] point_of_sale: improved rendering speed of the partner list
This commit is contained in:
parent
75a6bcaee4
commit
ac47f95bad
|
@ -560,6 +560,11 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
|
||||||
module.ClientListScreenWidget = module.ScreenWidget.extend({
|
module.ClientListScreenWidget = module.ScreenWidget.extend({
|
||||||
template: 'ClientListScreenWidget',
|
template: 'ClientListScreenWidget',
|
||||||
|
|
||||||
|
init: function(parent, options){
|
||||||
|
this._super(parent, options);
|
||||||
|
this.partner_cache = new module.DomCache();
|
||||||
|
},
|
||||||
|
|
||||||
show_leftpane: false,
|
show_leftpane: false,
|
||||||
|
|
||||||
auto_back: true,
|
auto_back: true,
|
||||||
|
@ -590,7 +595,6 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$('.client-list-contents').delegate('.client-line','click',function(event){
|
this.$('.client-list-contents').delegate('.client-line','click',function(event){
|
||||||
console.log('uh');
|
|
||||||
self.line_select(event,$(this),parseInt($(this).data('id')));
|
self.line_select(event,$(this),parseInt($(this).data('id')));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -631,14 +635,24 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
|
||||||
this.$('.searchbox input').focus();
|
this.$('.searchbox input').focus();
|
||||||
},
|
},
|
||||||
render_list: function(partners){
|
render_list: function(partners){
|
||||||
var contents = this.$('.client-list-contents');
|
var contents = this.$el[0].querySelector('.client-list-contents');
|
||||||
contents.empty();
|
contents.innerHtml = "";
|
||||||
for(var i = 0, len = partners.length; i < len; i++){
|
for(var i = 0, len = partners.length; i < len; i++){
|
||||||
var clientline = $(QWeb.render('ClientLine',{partner:partners[i]}));
|
var partner = partners[i];
|
||||||
if( partners[i] === this.new_client ){
|
var clientline = this.partner_cache.get_node(partner.id);
|
||||||
clientline.addClass('highlight');
|
if(!clientline){
|
||||||
|
var clientline_html = QWeb.render('ClientLine',{partner:partners[i]});
|
||||||
|
var clientline = document.createElement('tbody');
|
||||||
|
clientline.innerHTML = clientline_html;
|
||||||
|
clientline = clientline.childNodes[1];
|
||||||
|
this.partner_cache.cache_node(partner.id,clientline);
|
||||||
}
|
}
|
||||||
contents.append(clientline);
|
if( partners === this.new_client ){
|
||||||
|
clientline.classList.add('highlight');
|
||||||
|
}else{
|
||||||
|
clientline.classList.remove('highlight');
|
||||||
|
}
|
||||||
|
contents.appendChild(clientline);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
save_changes: function(){
|
save_changes: function(){
|
||||||
|
|
Loading…
Reference in New Issue