diff --git a/addons/point_of_sale/static/src/js/pos_screens.js b/addons/point_of_sale/static/src/js/pos_screens.js index df33c8a766a..1bd44363ddc 100644 --- a/addons/point_of_sale/static/src/js/pos_screens.js +++ b/addons/point_of_sale/static/src/js/pos_screens.js @@ -696,9 +696,6 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa this.pos_widget.order_widget.set_numpad_state(null); this.pos_widget.payment_screen.set_numpad_state(null); }, - paymentLineList: function() { - return this.$element.find('#paymentlines'); - }, back: function() { this.pos_widget.screen_selector.set_current_screen('products'); }, @@ -724,6 +721,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa this.currentOrderLines.bind('all', this.updatePaymentSummary, this); }, change_selected_order: function() { + console.log('change_selected_order'); this.currentPaymentLines.unbind(); this.bindPaymentLineEvents(); this.currentOrderLines.unbind(); @@ -731,15 +729,16 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa this.renderElement(); }, addPaymentLine: function(newPaymentLine) { + console.log('addPaymentLine:',newPaymentLine); var x = new module.PaymentlineWidget(null, { - model: newPaymentLine + payment_line: newPaymentLine }); x.on_delete.add(_.bind(this.deleteLine, this, x)); - x.appendTo(this.paymentLineList()); + x.appendTo(this.$('#paymentlines')); }, renderElement: function() { this._super(); - this.paymentLineList().empty(); + this.$('#paymentlines').empty(); this.currentPaymentLines.each(_.bind( function(paymentLine) { this.addPaymentLine(paymentLine); }, this)); diff --git a/addons/point_of_sale/static/src/js/pos_widgets.js b/addons/point_of_sale/static/src/js/pos_widgets.js index 63d1e9018d9..375e792dd11 100644 --- a/addons/point_of_sale/static/src/js/pos_widgets.js +++ b/addons/point_of_sale/static/src/js/pos_widgets.js @@ -247,8 +247,8 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa template: 'PaymentlineWidget', init: function(parent, options) { this._super(parent,options); - this.model = options.model; - this.model.bind('change', this.changedAmount, this); + this.payment_line = options.payment_line; + this.payment_line.bind('change', this.changedAmount, this); }, on_delete: function() {}, changeAmount: function(event) { @@ -256,18 +256,18 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa newAmount = event.currentTarget.value; if (newAmount && !isNaN(newAmount)) { this.amount = parseFloat(newAmount); - this.model.set({ + this.payment_line.set({ amount: this.amount, }); } }, changedAmount: function() { - if (this.amount !== this.model.get('amount')) + if (this.amount !== this.payment_line.get('amount')) this.renderElement(); }, renderElement: function() { - this.amount = this.model.get('amount'); - this.name = this.model.get('journal_id')[1]; + this.name = this.payment_line.get('journal_id')[1]; + this._super(); $('input', this.$element).keyup(_.bind(this.changeAmount, this)); $('.delete-payment-line', this.$element).click(this.on_delete); }, diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml index 793f9d56f0c..6bbb047ac6b 100644 --- a/addons/point_of_sale/static/src/xml/pos.xml +++ b/addons/point_of_sale/static/src/xml/pos.xml @@ -382,10 +382,10 @@ - + - +