diff --git a/addons/point_of_sale/static/src/css/pos.css b/addons/point_of_sale/static/src/css/pos.css
index 33fbf0b16cc..5e63b46d69e 100644
--- a/addons/point_of_sale/static/src/css/pos.css
+++ b/addons/point_of_sale/static/src/css/pos.css
@@ -507,29 +507,40 @@
.point-of-sale .pos-payment-container {
text-align: left;
}
-.point-of-sale .pos-payment-container .payment-due {
- display: block;
- margin-top: 10px;
- margin-bottom: 10px;
- padding: 3px 6px 0px 6px;
- background-color: white;
- border:1px solid grey;
- border-radius: 3px;
+.point-of-sale .pos-payment-container .left-block{
+ display: inline-block;
+ width:49%;
+ margin:0;
+ padding:0;
+ text-align:left;
+}
+.point-of-sale .pos-payment-container .header{
+ margin-top: 50px;
+ margin-bottom:20px;
+ font-weight: bold;
+}
+.point-of-sale .pos-payment-container .infoline{
+ margin-top:5px;
+ margin-bottom:5px;
+}
+.point-of-sale .pos-payment-container .right-block{
+ display: inline-block;
+ width:49%;
+ margin:0;
+ padding:0;
+ text-align:right;
}
.point-of-sale .pos-payment-container table {
width: 100%;
margin-bottom: 20px;
}
-.point-of-sale .pos-payment-container .paymentline-type {
- font-size: 0.8em;
- font-weight: bold;
+.point-of-sale .pos-payment-container td {
+ vertical-align: middle;
}
-.point-of-sale .screen button {
- width: 50%;
- text-align: center;
- padding: 7px 0 7px 0;
- font-size: 0.8em;
+.point-of-sale .pos-payment-container .paymentline-type {
+ font-size: 1em;
font-weight: bold;
+ margin-right:10px;
}
/* c) The receipt screen */
diff --git a/addons/point_of_sale/static/src/js/pos_devices.js b/addons/point_of_sale/static/src/js/pos_devices.js
index 82e45dd7105..93f09ad5a96 100644
--- a/addons/point_of_sale/static/src/js/pos_devices.js
+++ b/addons/point_of_sale/static/src/js/pos_devices.js
@@ -1,8 +1,6 @@
function openerp_pos_devices(instance,module){ //module is instance.point_of_sale
- var QWeb = instance.web.qweb; //TODO FIXME this should NOT be of any use in this file
-
window.debug_devices = new (instance.web.Class.extend({
active: false,
payment_status: 'waiting_for_payment',
diff --git a/addons/point_of_sale/static/src/js/pos_models.js b/addons/point_of_sale/static/src/js/pos_models.js
index 4eda2f1cb89..dd50cd272a2 100644
--- a/addons/point_of_sale/static/src/js/pos_models.js
+++ b/addons/point_of_sale/static/src/js/pos_models.js
@@ -513,7 +513,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
// An orderline contains a product, its quantity, its price, discount. etc.
// An Order contains zero or more Orderlines.
module.Orderline = Backbone.Model.extend({
- initialize: function(options){
+ initialize: function(attr,options){
this.pos = options.pos;
this.order = options.order;
this.product = options.product;
@@ -589,7 +589,6 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
is_selected: function(){
return this.selected;
},
-
// when we add an new orderline we want to merge it with the last line to see reduce the number of items
// in the orderline. This returns true if it makes sense to merge the two
can_be_merged_with: function(orderline){
@@ -691,11 +690,11 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
model: module.Orderline,
});
- // Every PaymentLine has all the attributes of the corresponding CashRegister.
+ // Every PaymentLine contains a cashregister and an amount CashRegister.
module.Paymentline = Backbone.Model.extend({
- initialize: function(cashRegister) {
+ initialize: function(attributes, options) {
this.amount = 0;
- this.cashregister = cashRegister;
+ this.cashregister = options.cashRegister;
},
//sets the amount of money on this payment line
set_amount: function(value){
@@ -714,7 +713,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
export_as_JSON: function(){
return {
name: instance.web.datetime_to_str(new Date()),
- statement_id: this.get('id'),
+ statement_id: this.cashregister.get('id'),
account_id: (this.cashregister.get('account_id'))[0],
journal_id: (this.cashregister.get('journal_id'))[0],
amount: this.get_amount()
@@ -746,8 +745,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
paymentLines: new module.PaymentlineCollection(),
name: "Order " + this.generateUniqueId(),
});
- this.pos = attributes.pos; //TODO put that in set and remember to use 'get' to read it ...
- this.pos_widget = attributes.pos_widget; //FIXME we shouldn't depend on pos_widget in the models
+ this.pos = attributes.pos;
this.selected_orderline = undefined;
return this;
},
@@ -758,7 +756,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
var attr = product.toJSON();
attr.pos = this.pos;
attr.order = this;
- var line = new module.Orderline({pos: this.pos, order: this, product: product});
+ var line = new module.Orderline({}, {pos: this.pos, order: this, product: product});
var self = this;
var last_orderline = this.getLastOrderline();
@@ -777,13 +775,12 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
return this.get('orderLines').at(this.get('orderLines').length -1);
},
addPaymentLine: function(cashRegister) {
- var newPaymentline;
- newPaymentline = new module.Paymentline(cashRegister);
- /* TODO: Should be 0 for cash-like accounts */
- //FIXME the following 'set' call calls this method once again via callback
- // events. Are we sure that it's what we want ???
- newPaymentline.set_amount( this.getDueLeft() );
- this.get('paymentLines').add(newPaymentline);
+ var paymentLines = this.get('paymentLines');
+ var newPaymentline = new module.Paymentline({},{cashRegister:cashRegister});
+ if(cashRegister.get('journal').type !== 'cash'){
+ newPaymentline.set_amount( this.getDueLeft() );
+ }
+ paymentLines.add(newPaymentline);
},
getName: function() {
return this.get('name');
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 b353cdd3207..d5be37ef92a 100644
--- a/addons/point_of_sale/static/src/js/pos_screens.js
+++ b/addons/point_of_sale/static/src/js/pos_screens.js
@@ -757,18 +757,19 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
this.updatePaymentSummary();
},
deleteLine: function(lineWidget) {
- this.currentPaymentLines.remove([lineWidget.model]);
+ this.currentPaymentLines.remove([lineWidget.payment_line]);
},
updatePaymentSummary: function() {
- var currentOrder, dueTotal, paidTotal, remaining, remainingAmount;
- currentOrder = this.pos.get('selectedOrder');
- paidTotal = currentOrder.getPaidTotal();
- dueTotal = currentOrder.getTotal();
- this.$element.find('#payment-due-total').html(dueTotal.toFixed(2));
- this.$element.find('#payment-paid-total').html(paidTotal.toFixed(2));
- remainingAmount = dueTotal - paidTotal;
- remaining = remainingAmount > 0 ? 0 : (-remainingAmount).toFixed(2);
- $('#payment-remaining').html(remaining);
+ var currentOrder = this.pos.get('selectedOrder');
+ var paidTotal = currentOrder.getPaidTotal();
+ var dueTotal = currentOrder.getTotal();
+ var remaining = dueTotal > paidTotal ? dueTotal - paidTotal : 0;
+ var change = paidTotal > dueTotal ? paidTotal - dueTotal : 0;
+
+ this.$('#payment-due-total').html(dueTotal.toFixed(2));
+ this.$('#payment-paid-total').html(paidTotal.toFixed(2));
+ this.$('#payment-remaining').html(remaining.toFixed(2));
+ this.$('#payment-change').html(change.toFixed(2));
},
set_numpad_state: function(numpadState) {
if (this.numpadState) {
diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml
index 7b4a168de87..1aa4951ee7b 100644
--- a/addons/point_of_sale/static/src/xml/pos.xml
+++ b/addons/point_of_sale/static/src/xml/pos.xml
@@ -162,36 +162,50 @@
-
+
-
-
- | Paid: |
-
+ |
-
-
- | Change: |
-
+
+
+
+
+ Remaining:
+
+
- |
-
-
+
+
+
+
+ Change:
+
+
+
+
+
+
+
+
@@ -465,7 +479,7 @@