[imp] added delete payment line

bzr revid: nicolas.vanhoren@openerp.com-20111219131750-ts70x8ng44grf63g
This commit is contained in:
niv-openerp 2011-12-19 14:17:50 +01:00
parent 8d2f664100
commit e9350239b0
3 changed files with 10 additions and 5 deletions

View File

@ -16,7 +16,7 @@
border-spacing: 0;
border-collapse: collapse;
}
.point-of-sale td {
.point-of-sale td {
border: 1px solid #e9eaec;
}
.point-of-sale input {

View File

@ -882,7 +882,9 @@ openerp.point_of_sale = function(db) {
start: function () {
this.$element.addClass('paymentline');
$('input', this.$element).keyup(_.bind(this.changeAmount, this));
$('.delete-payment-line', this.$element).click(this.on_delete);
},
on_delete: function() {},
changeAmount: function(event) {
var newAmount;
newAmount = event.currentTarget.value;
@ -929,6 +931,7 @@ openerp.point_of_sale = function(db) {
bindPaymentLineEvents: function() {
this.currentPaymentLines = (this.shop.get('selectedOrder')).get('paymentLines');
this.currentPaymentLines.bind('add', this.addPaymentLine, this);
this.currentPaymentLines.bind('remove', this.render_element, this);
this.currentPaymentLines.bind('all', this.updatePaymentSummary, this);
},
bindOrderLineEvents: function() {
@ -946,18 +949,19 @@ openerp.point_of_sale = function(db) {
var x = new PaymentlineWidget(null, {
model: newPaymentLine
});
x.on_delete.add(_.bind(this.deleteLine, this, x));
x.appendTo(this.paymentLineList());
},
render_element: function() {
this.paymentLineList().empty();
this.currentPaymentLines.each(_.bind( function(paymentLine) {
var x = new PaymentlineWidget(null, {
model: paymentLine
});
this.paymentLineList().append(x);
this.addPaymentLine(paymentLine);
}, this));
this.updatePaymentSummary();
},
deleteLine: function(lineWidget) {
this.currentPaymentLines.remove([lineWidget.model]);
},
updatePaymentSummary: function() {
var currentOrder, dueTotal, paidTotal, remaining, remainingAmount;
currentOrder = this.shop.get('selectedOrder');

View File

@ -222,6 +222,7 @@
</td>
<td class="paymentline-amount pos-rigth-align">
<input type="text" t-att-value="amount.toFixed(2)" />
<a href='javascript:void(0)' class='delete-payment-line'><img src="/point_of_sale/static/src/img/search_reset.gif" /></a>
</td>
</t>
<t t-name="pos-payment-button-template">