From ca28f214e48d1727a4ca988e39b0708ee058f509 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Wed, 9 Oct 2013 12:13:25 +0200 Subject: [PATCH] [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 --- addons/point_of_sale/static/src/css/pos.css | 4 ++++ addons/point_of_sale/static/src/js/widgets.js | 8 +++++--- addons/point_of_sale/static/src/xml/pos.xml | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/addons/point_of_sale/static/src/css/pos.css b/addons/point_of_sale/static/src/css/pos.css index 38f61a25c29..ff4b5d13174 100644 --- a/addons/point_of_sale/static/src/css/pos.css +++ b/addons/point_of_sale/static/src/css/pos.css @@ -21,6 +21,10 @@ text-shadow: none; } +.point-of-sale * { + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); +} + .point-of-sale .oe_hidden{ display: none !important; } diff --git a/addons/point_of_sale/static/src/js/widgets.js b/addons/point_of_sale/static/src/js/widgets.js index 0f440dcb750..476534bd3d7 100644 --- a/addons/point_of_sale/static/src/js/widgets.js +++ b/addons/point_of_sale/static/src/js/widgets.js @@ -581,15 +581,17 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa renderElement: function() { var self = this; this._super(); - + var products = this.pos.get('products').models || []; - + _.each(products,function(product,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('a').click(function(){ self.click_product_action(product); }); $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')))); + }); }, }); diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml index d5f57e099f7..daa1164a2df 100644 --- a/addons/point_of_sale/static/src/xml/pos.xml +++ b/addons/point_of_sale/static/src/xml/pos.xml @@ -401,7 +401,7 @@
  • - +