[WIP] point_of_sale: mobile ui optimisations

bzr revid: fva@openerp.com-20131125172726-xp81rn938rtfwlbs
This commit is contained in:
Frédéric van der Essen
2013-11-25 18:27:26 +01:00
parent 3fe26a6bb7
commit 1a96fe1402
4 changed files with 41 additions and 8 deletions
@@ -3,6 +3,10 @@
src: url(../fonts/Inconsolata.otf);
}
.oe_hidden{
display: none !important;
}
.pos {
padding: 0;
margin: 0;
@@ -416,6 +420,7 @@
overflow: hidden;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
-webkit-transform: translate3d(0,0,0);
}
.pos .product-list-container {
@@ -970,7 +970,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
var currentOrder = this.pos.get('selectedOrder');
if(currentOrder.getPaidTotal() + 0.000001 < currentOrder.getTotalTaxIncluded()){
if(!this.isPaymentPaid()){
return;
}
@@ -1066,6 +1066,12 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
this.currentPaymentLines.remove([lineWidget.payment_line]);
lineWidget.destroy();
},
isPaymentPaid: function(){
var currentOrder = this.pos.get('selectedOrder');
return (currentOrder.getTotalTaxIncluded < 0.000001
&& currentOrder.getPaidTotal() + 0.000001 < currentOrder.getTotalTaxIncluded());
},
updatePaymentSummary: function() {
var currentOrder = this.pos.get('selectedOrder');
var paidTotal = currentOrder.getPaidTotal();
@@ -1082,8 +1088,8 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
}
if(this.pos_widget.action_bar){
this.pos_widget.action_bar.set_button_disabled('validation', remaining > 0.000001);
this.pos_widget.action_bar.set_button_disabled('invoice', remaining > 0.000001);
this.pos_widget.action_bar.set_button_disabled('validation', this.isPaymentPaid());
this.pos_widget.action_bar.set_button_disabled('invoice', this.isPaymentPaid());
}
},
set_numpad_state: function(numpadState) {
+26 -4
View File
@@ -213,13 +213,13 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
var scroller = this.$('.order-scroller')[0];
var scrollbottom = true;
var scrollTop = 0;
if(scroller){
/*if(scroller){
var overflow_bottom = scroller.scrollHeight - scroller.clientHeight;
scrollTop = scroller.scrollTop;
if( !goto_bottom && scrollTop < 0.9 * overflow_bottom){
scrollbottom = false;
}
}
}*/
this._super();
// freeing subwidgets
@@ -245,11 +245,13 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
scroller = this.$('.order-scroller')[0];
if(scroller){
//scroller.scrollTop = 1000000;
/*
if(scrollbottom){
scroller.scrollTop = scroller.scrollHeight - scroller.clientHeight;
}else{
scroller.scrollTop = scrollTop;
}
}*/
}
},
update_summary: function(){
@@ -835,6 +837,12 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
self.pos.delete_current_order();
});
$('body').on('keyup',function(event){
if(event.which === 13){
self.set_fullscreen();
}
});
//when a new order is created, add an order button widget
self.pos.get('orders').bind('add', function(new_order){
var new_order_button = new module.OrderButtonWidget(null, {
@@ -858,6 +866,13 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
self.pos.barcode_reader.connect();
if(!$('#oe-fullscreenwidget-viewport').length){
$('head').append('<meta id="oe-pos-viewport" name="viewport" content=" width=1024px; user-scalable=no;">');
$('head').append('<meta id="oe-pos-apple-mobile" name="apple-mobile-web-capable" content="yes">');
}
$('.oe_leftbar').addClass('oe_hidden');
instance.webclient.set_content_full_screen(true);
if (!self.pos.get('pos_session')) {
@@ -1050,7 +1065,11 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
}
}
},
set_fullscreen: function(){
if(this.el.webkitRequestFullscreen){
this.el.webkitRequestFullscreen();
}
},
//shows or hide the leftpane (contains the list of orderlines, the numpad, the paypad, etc.)
set_leftpane_visible: function(visible){
if(visible !== this.leftpane_visible){
@@ -1105,6 +1124,9 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
destroy: function() {
this.pos.destroy();
instance.webclient.set_content_full_screen(false);
$('.oe_leftbar').removeClass('oe_hidden');
$('#oe-pos-viewport').remove();
$('#oe-pos-apple-mobile').remove();
this._super();
}
});
+1 -1
View File
@@ -580,7 +580,7 @@
<t t-esc="widget.name"/>
</td>
<td class="paymentline-amount pos-right-align">
<input type="text" t-att-value="widget.payment_line.get_amount().toFixed(2)" />
<input type="number" t-att-value="widget.payment_line.get_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>
</tr>