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'))));
+ });
},
});
<t t-name="Product">
<li class='product'>
- <a href="#">
+ <a href="#" t-att-data-product-id="product.id">
<div class="product-img">
<img src='' /> <!-- the product thumbnail -->
<t t-if="!product.get('to_weight')">