[fix] categories were broken

bzr revid: nicolas.vanhoren@openerp.com-20111107141323-zmariwqu0qns3bcm
This commit is contained in:
niv-openerp
2011-11-07 15:13:23 +01:00
parent 085f90d989
commit db36bc97b4
2 changed files with 15 additions and 6 deletions
@@ -751,6 +751,10 @@ openerp.point_of_sale = function(db) {
function CategoryView() {
CategoryView.__super__.constructor.apply(this, arguments);
}
CategoryView.prototype.events = {
'click .oe-pos-categories-list a': 'changeCategory'
};
CategoryView.prototype.template = qweb_template('pos-category-template');
CategoryView.prototype.render = function(ancestors, children) {
@@ -776,6 +780,10 @@ openerp.point_of_sale = function(db) {
})()
}));
};
CategoryView.prototype.changeCategory = function(a) {
var id = $(a.target).data("category-id");
this.trigger("changeCategory", id);
};
return CategoryView;
})();
ProductView = (function() {
@@ -1153,6 +1161,7 @@ openerp.point_of_sale = function(db) {
}
c = pos.categories[id];
$('#products-screen').html(this.categoryView.render(c.ancestors, c.children));
this.categoryView.delegateEvents();
products = pos.store.get('product.product').filter( function(p) {
var _ref;
return _ref = p.pos_categ_id[0], __indexOf.call(c.subtree, _ref) >= 0;
+6 -6
View File
@@ -143,15 +143,15 @@
<t t-name="pos-category-template">
<header>
<ol class="breadcrumb">
<li>
<a href="#">
<li class="oe-pos-categories-list">
<a href="javascript:void(0)">
<img src="/point_of_sale/static/src/img/home.png" class="homeimg" />
</a>
</li>
<t t-foreach="breadcrumb" t-as="category">
<li>
<li class="oe-pos-categories-list">
<img src="/point_of_sale/static/src/img/bc-arrow.png" class="bc-arrow" />
<a t-att-href="'#category/' + category.id">
<a href="javascript:void(0)" t-att-data-category-id="category.id">
<t t-esc="category.name"/>
</a>
</li>
@@ -166,8 +166,8 @@
<h4>Categories:</h4>
<ol>
<t t-foreach="categories" t-as="category">
<li>
<a t-att-href="'#category/' + category.id" class="button">
<li class="oe-pos-categories-list">
<a href="javascript:void(0)" t-att-data-category-id="category.id" class="button">
<t t-esc="category.name"/>
</a>
</li>