diff --git a/addons/point_of_sale/static/src/css/pos.css b/addons/point_of_sale/static/src/css/pos.css
index 5688e134023..6fd101cd0e8 100644
--- a/addons/point_of_sale/static/src/css/pos.css
+++ b/addons/point_of_sale/static/src/css/pos.css
@@ -37,6 +37,7 @@ div.modal.in {
top: 50%;
left: 50%;
}
+
/* --- Generic Restyling and Resets --- */
html {
@@ -545,7 +546,7 @@ td {
/* ********* The actionpad (payment, set customer) ********* */
-.pos .actionpad{
+.pos .actionpad {
padding: 8px 3px 8px 19px;
display: inline-block;
text-align: center;
@@ -981,7 +982,7 @@ td {
overflow-y: auto;
}
.screen .right-content.pc60{
- left:34%
+ left:34%;
}
.screen .centered-content{
position: absolute;
@@ -1044,7 +1045,6 @@ td {
width: 66px;
height: 66px;
}
-
.pos .paymentlines-container {
padding: 16px;
padding-top: 0;
@@ -1082,7 +1082,6 @@ td {
position: relative;
border-radius: 3px;
}
-
.pos .paymentline > *{
padding: 8px 12px;
}
@@ -1108,29 +1107,29 @@ td {
padding: 16px;
float: right;
}
-
-.payment-screen .payment-buttons .button {
- background: rgb(221, 221, 221);
+.payment-screen .payment-buttons .button {
+ background: rgb(220,220,220);
line-height: 48px;
margin-bottom: 4px;
border-radius: 3px;
font-size: 16px;
padding: 0px 8px;
- border: solid 1px rgb(202, 202, 202);
+ border: solid 1px rgb(200,200,200);
cursor: pointer;
text-align: center;
}
-.payment-screen .paymentlines-empty .total {
+.payment-screen .paymentlines-empty .total {
text-align: center;
padding: 24px 0px 18px;
font-size: 64px;
color: #43996E;
text-shadow: 0px 2px white, 0px 2px 2px rgba(0, 0, 0, 0.27);
}
-.payment-screen .paymentlines-empty .message {
+.payment-screen .paymentlines-empty .message {
text-align: center;
}
+
/* c) The receipt screen */
.pos .receipt-screen .centered-content .button {
@@ -1145,6 +1144,7 @@ td {
border: solid 1px rgb(209, 209, 209);
cursor: pointer;
}
+
.pos .pos-receipt-container {
font-size: 0.75em;
text-align: center;
@@ -1195,7 +1195,7 @@ td {
.oe_leftbar,
.pos .pos-topheader,
.pos .pos-leftpane,
- .pos .keyboard_frame,
+ .pos .keyboard_frame,
.pos .receipt-screen header,
.pos .receipt-screen .top-content,
.pos .receipt-screen .centered-content .button {
@@ -1225,7 +1225,6 @@ td {
.pos .receipt-screen .centered-content{
position: static;
border: none;
- margin: none;
}
.pos .pos-receipt-container {
text-align: left;
@@ -1631,11 +1630,11 @@ td {
vertical-align: top;
}
.splitbill-screen .paymentmethods,
-.payment-screen .paymentmethods {
+.payment-screen .paymentmethods {
margin: 16px;
}
.splitbill-screen .paymentmethod,
-.payment-screen .paymentmethod {
+.payment-screen .paymentmethod {
background: rgb(221, 221, 221);
line-height: 40px;
margin-bottom: 4px;
@@ -1646,7 +1645,7 @@ td {
text-align: center;
}
.splitbill-screen .paymentmethod.active,
-.payment-screen .paymentmethod.active {
+.payment-screen .paymentmethod.active {
background: #6EC89B;
color: white;
border-color: #6EC89B;
diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js
index d22c35cd036..8b59049c97c 100644
--- a/addons/point_of_sale/static/src/js/models.js
+++ b/addons/point_of_sale/static/src/js/models.js
@@ -619,8 +619,8 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
return server_ids;
}).fail(function (error, event){
if(error.code === 200 ){ // Business Logic Error, not a connection problem
- //if warning do not need to dispaly traceback!!
- if(error.data.exception_type == 'warning'){
+ //if warning do not need to display traceback!!
+ if (error.data.exception_type == 'warning') {
delete error.data.debug;
}
self.pos_widget.screen_selector.show_popup('error-traceback',{
@@ -974,7 +974,6 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
this.selected_orderline = undefined;
this.selected_paymentline = undefined;
this.screen_data = {}; // see ScreenSelector
- this.receipt_type = 'receipt'; // 'receipt' || 'invoice'
this.temporary = attributes.temporary || false;
this.to_invoice = false;
return this;
@@ -982,6 +981,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
is_empty: function(){
return (this.get('orderLines').models.length === 0);
},
+
// Generates a public identification number for the order.
// The generated number must be unique and sequential. They are made 12 digit long
// to fit into EAN-13 barcodes, should it be needed
@@ -1163,12 +1163,24 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
finalize: function(){
this.destroy();
},
- // sets the type of receipt 'receipt'(default) or 'invoice'
- set_receipt_type: function(type){
- this.receipt_type = type;
+ set_to_invoice: function(to_invoice) {
+ this.to_invoice = to_invoice;
},
- get_receipt_type: function(){
- return this.receipt_type;
+ is_to_invoice: function(){
+ return this.to_invoice;
+ },
+ // remove all the paymentlines with zero money in it
+ clean_empty_paymentlines: function() {
+ var lines = this.get('paymentLines').models;
+ var empty = [];
+ for ( var i = 0; i < lines.length; i++) {
+ if (!lines[i].get_amount()) {
+ empty.push(lines[i]);
+ }
+ }
+ for ( var i = 0; i < empty.length; i++) {
+ this.removePaymentline(empty[i]);
+ }
},
// the client related to the current order.
set_client: function(client){
diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js
index 46614f1e2ae..f879db43227 100644
--- a/addons/point_of_sale/static/src/js/screens.js
+++ b/addons/point_of_sale/static/src/js/screens.js
@@ -975,9 +975,9 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
// 2 seconds is the same as the default timeout for sending orders and so the dialog
// should have appeared before the timeout... so yeah that's not ultra reliable.
- this.lock_screen(true);
+ this.lock_screen(true);
setTimeout(function(){
- self.lock_screen(false);
+ self.lock_screen(false);
}, 2000);
},
lock_screen: function(locked) {
@@ -1156,6 +1156,10 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
render_paymentlines: function() {
var self = this;
var order = this.pos.get_order();
+ if (!order) {
+ return;
+ }
+
var lines = order.get('paymentLines').models;
this.$('.paymentlines-container').empty();
@@ -1245,6 +1249,9 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
watch_order_changes: function() {
var self = this;
var order = this.pos.get_order();
+ if (!order) {
+ return;
+ }
if(this.old_order){
this.old_order.unbind(null,null,this);
}
@@ -1258,7 +1265,9 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
order_changes: function(){
var self = this;
var order = this.pos.get_order();
- if (order.isPaid()) {
+ if (!order) {
+ return;
+ } else if (order.isPaid()) {
self.$('.next').addClass('highlight');
}else{
self.$('.next').removeClass('highlight');
@@ -1271,7 +1280,9 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
var order = this.pos.get_order();
- if(order.get('orderLines').models.length === 0){
+ // FIXME: this check is there because the backend is unable to
+ // process empty orders. This is not the right place to fix it.
+ if(order.get_orderlines().length === 0){
this.pos_widget.screen_selector.show_popup('error',{
'message': _t('Empty Order'),
'comment': _t('There must be at least one product in your order before it can be validated'),
@@ -1344,3 +1355,4 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
});
}
+
diff --git a/addons/point_of_sale/static/src/js/widget_base.js b/addons/point_of_sale/static/src/js/widget_base.js
index f0764d2f43d..d81e230204b 100644
--- a/addons/point_of_sale/static/src/js/widget_base.js
+++ b/addons/point_of_sale/static/src/js/widget_base.js
@@ -1,7 +1,7 @@
function openerp_pos_basewidget(instance, module){ //module is instance.point_of_sale
var round_di = instance.web.round_decimals;
- var round_pr = instance.web.round_precision
+ var round_pr = instance.web.round_precision;
// This is a base class for all Widgets in the POS. It exposes relevant data to the
// templates :
@@ -21,6 +21,17 @@ function openerp_pos_basewidget(instance, module){ //module is instance.point_of
},
format_currency: function(amount,precision){
var currency = (this.pos && this.pos.currency) ? this.pos.currency : {symbol:'$', position: 'after', rounding: 0.01, decimals: 2};
+
+ amount = this.format_currency_no_symbol(amount,precision);
+
+ if (currency.position === 'after') {
+ return amount + ' ' + (currency.symbol || '');
+ } else {
+ return (currency.symbol || '') + ' ' + amount;
+ }
+ },
+ format_currency_no_symbol: function(amount, precision) {
+ var currency = (this.pos && this.pos.currency) ? this.pos.currency : {symbol:'$', position: 'after', rounding: 0.01, decimals: 2};
var decimals = currency.decimals;
if (precision && (typeof this.pos.dp[precision]) !== undefined) {
@@ -28,7 +39,7 @@ function openerp_pos_basewidget(instance, module){ //module is instance.point_of
}
this.format_currency_no_symbol = function(amount){
- amount = round_pr(amount,this.currency.rounding);
+ amount = round_pr(amount,currency.rounding);
amount = amount.toFixed(decimals);
return amount;
};
@@ -37,11 +48,7 @@ function openerp_pos_basewidget(instance, module){ //module is instance.point_of
amount = round_di(amount,decimals).toFixed(decimals);
}
- if (currency.position === 'after') {
- return amount + ' ' + (currency.symbol || '');
- } else {
- return (currency.symbol || '') + ' ' + amount;
- }
+ return amount;
},
show: function(){
this.$el.removeClass('oe_hidden');
diff --git a/addons/point_of_sale/static/src/js/widgets.js b/addons/point_of_sale/static/src/js/widgets.js
index dba0328b3d1..423c34ced4f 100644
--- a/addons/point_of_sale/static/src/js/widgets.js
+++ b/addons/point_of_sale/static/src/js/widgets.js
@@ -83,7 +83,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
},
});
- // The action pads contains the payment button and the customer selection button.
+ // The action pad contains the payment button and the customer selection button
module.ActionpadWidget = module.PosBaseWidget.extend({
template: 'ActionpadWidget',
renderElement: function() {
@@ -317,48 +317,6 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
},
});
- module.OrderButtonWidget = module.PosBaseWidget.extend({
- template:'OrderButtonWidget',
- init: function(parent, options) {
- this._super(parent,options);
- var self = this;
-
- this.order = options.order;
- this.order.bind('destroy',this.destroy, this );
- this.order.bind('change', this.renderElement, this );
- this.pos.bind('change:selectedOrder', this.renderElement,this );
- },
- renderElement:function(){
- this.selected = ( this.pos.get_order() === this.order )
- this._super();
- var self = this;
- this.$el.click(function(){
- if( self.pos.get_order() === self.order ){
- var ss = self.pos.pos_widget.screen_selector;
- if(ss.get_current_screen() === 'clientlist'){
- ss.back();
- }else if (ss.get_current_screen() !== 'receipt'){
- ss.set_current_screen('clientlist');
- }
- }else{
- self.selectOrder();
- }
- });
- if( this.selected){
- this.$el.addClass('selected');
- }
- },
- selectOrder: function(event) {
- this.pos.set_order(this.order);
- },
- destroy: function(){
- this.order.unbind('destroy', this.destroy, this);
- this.order.unbind('change', this.renderElement, this);
- this.pos.unbind('change:selectedOrder', this.renderElement, this);
- this._super();
- },
- });
-
module.ProductCategoriesWidget = module.PosBaseWidget.extend({
template: 'ProductCategoriesWidget',
init: function(parent, options){
diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml
index c98c9eb0fed..2e668f7a08e 100644
--- a/addons/point_of_sale/static/src/xml/pos.xml
+++ b/addons/point_of_sale/static/src/xml/pos.xml
@@ -126,11 +126,11 @@
-
+
-
@@ -557,8 +557,9 @@
+
-
+
@@ -589,24 +590,23 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+