diff options
| author | niv-openerp <nicolas.vanhoren@openerp.com> | 2011-12-23 17:15:02 +0100 |
|---|---|---|
| committer | niv-openerp <nicolas.vanhoren@openerp.com> | 2011-12-23 17:15:02 +0100 |
| commit | ca9b8158aaa2fddcc643bd0d4f5fdd322ce22e32 (patch) | |
| tree | 592fd82e7280090d293ec87e86d2e597b1f3ec5e /addons | |
| parent | 7c564be8ad677eb34b9f911bfe4252b060372627 (diff) | |
[fix] small problem with scrollbar in order lines in pos
bzr revid: nicolas.vanhoren@openerp.com-20111223161502-qtva9qrk3ifn9q25
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/point_of_sale/static/src/js/pos.js | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/addons/point_of_sale/static/src/js/pos.js b/addons/point_of_sale/static/src/js/pos.js index ccb9b0442e0..232992e6740 100644 --- a/addons/point_of_sale/static/src/js/pos.js +++ b/addons/point_of_sale/static/src/js/pos.js @@ -688,25 +688,30 @@ openerp.point_of_sale = function(db) { this._super(parent); this.model = options.model; this.model.bind('change', _.bind( function() { - this.$element.hide(); - this.render_element(); + this.refresh(); }, this)); this.model.bind('remove', _.bind( function() { - return this.$element.remove(); + this.$element.remove(); }, this)); this.order = options.order; }, start: function() { this.$element.click(_.bind(this.clickHandler, this)); + this.refresh(); }, clickHandler: function() { this.select(); }, render_element: function() { + this.$element.html(this.template_fct(this.model.toJSON())); this.select(); - return this.$element.html(this.template_fct(this.model.toJSON())).fadeIn(400, function() { - return $('#current-order').scrollTop($(this).offset().top); - }); + }, + refresh: function() { + this.render_element(); + var heights = _.map(this.$element.prevAll(), function(el) {return $(el).outerHeight();}); + heights.push($('#current-order thead').outerHeight()); + var position = _.reduce(heights, function(memo, num){ return memo + num; }, 0); + $('#current-order').scrollTop(position); }, select: function() { $('tr.selected').removeClass('selected'); |
