[WIP] point_of_sale: used one jquery event handler for all products in product list in order to accelerate rerendering
bzr revid: fva@openerp.com-20131009101325-d71q3ppxb7hstzvd
This commit is contained in:
parent
9329c3ba9d
commit
ca28f214e4
|
@ -21,6 +21,10 @@
|
||||||
text-shadow: none;
|
text-shadow: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.point-of-sale * {
|
||||||
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
.point-of-sale .oe_hidden{
|
.point-of-sale .oe_hidden{
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
|
@ -581,15 +581,17 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
|
||||||
renderElement: function() {
|
renderElement: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
this._super();
|
this._super();
|
||||||
|
|
||||||
var products = this.pos.get('products').models || [];
|
var products = this.pos.get('products').models || [];
|
||||||
|
|
||||||
_.each(products,function(product,i){
|
_.each(products,function(product,i){
|
||||||
var $product = $(QWeb.render('Product',{ widget:self, product: products[i] }));
|
var $product = $(QWeb.render('Product',{ widget:self, product: products[i] }));
|
||||||
$product.find('img').replaceWith(self.pos_widget.image_cache.get_image(products[i].get_image_url()));
|
$product.find('img').replaceWith(self.pos_widget.image_cache.get_image(products[i].get_image_url()));
|
||||||
$product.find('a').click(function(){ self.click_product_action(product); });
|
|
||||||
$product.appendTo(self.$('.product-list'));
|
$product.appendTo(self.$('.product-list'));
|
||||||
});
|
});
|
||||||
|
this.$el.delegate('a','click',function(){
|
||||||
|
self.click_product_action(new module.Product(self.pos.db.get_product_by_id(+$(this).data('product-id'))));
|
||||||
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -401,7 +401,7 @@
|
||||||
|
|
||||||
<t t-name="Product">
|
<t t-name="Product">
|
||||||
<li class='product'>
|
<li class='product'>
|
||||||
<a href="#">
|
<a href="#" t-att-data-product-id="product.id">
|
||||||
<div class="product-img">
|
<div class="product-img">
|
||||||
<img src='' /> <!-- the product thumbnail -->
|
<img src='' /> <!-- the product thumbnail -->
|
||||||
<t t-if="!product.get('to_weight')">
|
<t t-if="!product.get('to_weight')">
|
||||||
|
|
Loading…
Reference in New Issue