[IMP] point_of_sale: more css adaptations for iPad / android + a few bug correction...
authorFrédéric van der Essen <fva@openerp.com>
Wed, 6 Nov 2013 16:17:23 +0000 (17:17 +0100)
committerFrédéric van der Essen <fva@openerp.com>
Wed, 6 Nov 2013 16:17:23 +0000 (17:17 +0100)
bzr revid: fva@openerp.com-20131106161723-vus7amgc6cfw3bzr

addons/point_of_sale/point_of_sale.py
addons/point_of_sale/point_of_sale_view.xml
addons/point_of_sale/static/src/css/keyboard.css
addons/point_of_sale/static/src/css/pos.css
addons/point_of_sale/static/src/img/scroll-down.png [new file with mode: 0644]
addons/point_of_sale/static/src/img/scroll-up.png [new file with mode: 0644]
addons/point_of_sale/static/src/js/models.js
addons/point_of_sale/static/src/js/screens.js
addons/point_of_sale/static/src/js/widget_keyboard.js
addons/point_of_sale/static/src/js/widgets.js

index d32b8e9..344eddb 100644 (file)
@@ -64,6 +64,7 @@ class pos_config(osv.osv):
         'iface_vkeyboard' : fields.boolean('Virtual KeyBoard Interface'),
         'iface_print_via_proxy' : fields.boolean('Print via Proxy'),
         'iface_invoicing': fields.boolean('Invoicing',help='Enables invoice generation from the Point of Sale'),
+        'iface_big_scrollbars': fields.boolean('Large Scrollbars',help='For imprecise industrial touchscreens'),
 
         'state' : fields.selection(POS_CONFIG_STATE, 'Status', required=True, readonly=True),
         'sequence_id' : fields.many2one('ir.sequence', 'Order IDs Sequence', readonly=True,
index 7202b57..11893bd 100644 (file)
                                 <field name="iface_electronic_scale" />
                                 <field name="iface_vkeyboard" />
                                 <field name="iface_print_via_proxy" />
+                                <field name="iface_big_scrollbars" />
                             </group>
                         </group>
                     </sheet>
index d060735..36cbea0 100644 (file)
@@ -28,7 +28,6 @@
     background-color: #DDD;
     font-size: 12px;
     line-height:40px;
-    border: 1px solid #CCC;
        -webkit-border-radius: 5px;
     position:absolute;
     top:0;
        background-color: #fff;
        border: 1px solid #f0f0f0;
     top:0;
+    cursor: pointer;
        -moz-border-radius: 5px;
        -webkit-border-radius: 5px;
     -webkit-transition-property: top, background-color;
     -webkit-transition-duration: 0.2s;
     -webkit-transition-timing-function: linear;
 }
-.pos .keyboard li:hover {
+.pos .keyboard li:active{
        position: relative;
        top: 2px;
        left: 0px;
index 8183132..f1a0ea8 100644 (file)
     margin-right:0px;
     border: 1px solid #353A7E;
     background: #7f82ac;
+    text-shadow: none;
 }
 
 .pos .pos-rightheader button.square{
     width:100%;
     height:100%;
     overflow: hidden;
-    overflow-y: scroll;
+    overflow-y: auto;
     -webkit-overflow-scrolling: touch;
 
 }
     line-height: 13px;
     background: #7f82ac;
     padding: 2px 5px;
+    border-radius: 2px;
 }
 
 .pos .product .product-name {
     bottom:0px;
     width:100%;
     overflow: auto;
+    -webkit-overflow-scrolling: touch;
 }
 .pos .screen header h2 {
     margin-top: 0px;
     margin-left: auto;
     margin-right: auto;
     margin-top: 50px;
-    padding: 40px;
-    background-color: #f8f8f8;
     text-align: center;
 }
 .pos .dialog p{
 
 .pos .scale-screen .display{
     position:relative;
-    width:600px;
+    width: 550px;
     height:190px;
     margin-top: 100px;
     margin-left: auto;
     margin-right: auto;
-    padding: 40px;
-    background: #f1f1f1;
-    border-top: 1px solid #efefef;
 }
 
 .pos .scale-screen .product-picture {
 
     background:#fff;
     border: 1px solid #fff;
+    border-radius: 3px;
+    box-shadow: 0px 2px rgb(228, 228, 228);
 }
 
 .pos .scale-screen .product-picture img{
-    max-width: 178px;
-    max-height:178px;
+    max-width:  178px;
+    max-height: 178px;
     vertical-align: middle;
     cursor:pointer;
 }
     line-height:1;
     color:white;
     background: #7f82ac;
-    padding: 2px 5px;
+    padding: 4px 5px;
+    border-radius: 3px;
     cursor:pointer;
 }
 
 .pos .scale-screen .product-name {
     position: absolute;
-    left:40px;
-    top:50px;
-    height:50px;
-    font-size:36px;
-    line-height:50px;
-    text-align:right;
-    right:275px;
+    left: 0px;
+    right: 210px;
+    top: 10px;
+    height: 50px;
+    font-size: 36px;
+    line-height: 50px;
+    text-align: right;
     color: #8d8d8d;
     overflow: hidden;
     text-overflow: ellipsis;
 }
 .pos .scale-screen .weight{
-    position: absolute;
-    left: 40px;
-    height: 90px;
-    bottom: 55px;
-    right: 260px;
-    padding: 6px;
-    padding-right: 33px;
-    padding-top: 11px;
-    background: white;
-
+   position: absolute;
+   left: 0;
+   top: 80px;
+   height: 90px;
+   bottom: 55px;
+   right: 210px;
+   padding: 6px;
+   padding-right: 33px;
+   padding-top: 11px;
+   background: white;
+   border-radius: 3px;
+   box-shadow: 0px 2px rgb(228, 228, 228) inset;
 }
 .pos .scale-screen .weight p{
     display: inline-block;
     text-align:right;
     line-height: 90px;
-    font-size: 70px;
+    font-size: 56px;
     width: 100%;
     height: 100%;
     margin: 0;
     font-weight:bold;
     background-color: #F0EEEE;
     border: 1px solid #E0DDDD;
+    border-radius: 3px;
+    box-shadow: 0px 10px 20px rgba(0,0,0,0.4);
     z-index:1150;
 }
 
     width:100%;
     height:100%;
     overflow:hidden;
-    overflow-y: scroll;
+    overflow-y: auto;
     -webkit-overflow-scrolling: touch;
 }
 
     border-color:#777;
 }
 .pos .order .summary .line .subentry{
-    font-size: 10px;
+    font-size: 14px;
     font-weight: normal;
     text-align: center;
 }
     -webkit-transition-timing-function: ease-out;
 }
 
+.pos .pos-actionbar .button.disabled{
+    opacity: 0.5;
+}
 .pos .pos-actionbar .button.disabled:active{
     border: 1px solid #cacaca;
     color: #555;
     font-size:20px;
     font-weight:bold;
     background-color: #F0EEEE;
+    border-radius: 3px;
+    box-shadow: 0px 10px 20px rgba(0,0,0,0.4);
     z-index:1200;
 }
 .pos .popup .footer{
     min-height: 30px;
 }
 
+.pos.big-scrollbars *::-webkit-scrollbar{
+    width:  40px;
+    height: 40px;
+}
+.pos.big-scrollbars *::-webkit-scrollbar-track{
+    background: rgb(224,224,224);
+    border-left: none;
+}
+.pos.big-scrollbars *::-webkit-scrollbar-thumb{
+    background: rgb(168,168,168);
+    min-height: 40px;
+    border-radius: 3px;
+}
+.pos.big-scrollbars *::-webkit-scrollbar-button{
+    width:  40px;
+    height: 40px;
+    border-radius: 3px;
+    background: rgb(210,210,210);
+    background-size: cover;
+}
+.pos.big-scrollbars *::-webkit-scrollbar-button:decrement{
+    background-image: url('../img/scroll-up.png');
+}
+.pos.big-scrollbars *::-webkit-scrollbar-button:increment{
+    background-image: url('../img/scroll-down.png');
+}
+
+
 /*  ********* Unsupported Browser Page ********* */
 
 .pos .not-supported-browser{
diff --git a/addons/point_of_sale/static/src/img/scroll-down.png b/addons/point_of_sale/static/src/img/scroll-down.png
new file mode 100644 (file)
index 0000000..5fd0758
Binary files /dev/null and b/addons/point_of_sale/static/src/img/scroll-down.png differ
diff --git a/addons/point_of_sale/static/src/img/scroll-up.png b/addons/point_of_sale/static/src/img/scroll-up.png
new file mode 100644 (file)
index 0000000..b34a900
Binary files /dev/null and b/addons/point_of_sale/static/src/img/scroll-up.png differ
index e47101c..3de24b2 100644 (file)
@@ -152,7 +152,8 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
                         ['name','journal_ids','warehouse_id','journal_id','pricelist_id',
                          'iface_self_checkout', 'iface_led', 'iface_cashdrawer',
                          'iface_payment_terminal', 'iface_electronic_scale', 'iface_barscan', 'iface_vkeyboard',
-                         'iface_print_via_proxy','iface_cashdrawer','iface_invoicing','state','sequence_id','session_ids'],
+                         'iface_print_via_proxy','iface_cashdrawer','iface_invoicing','iface_big_scrollbars',
+                         'state','sequence_id','session_ids'],
                         [['id','=', self.get('pos_session').config_id[0]]]
                     );
                 }).then(function(configs){
@@ -164,6 +165,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
                     self.iface_self_checkout       =  !!pos_config.iface_self_checkout;
                     self.iface_cashdrawer          =  !!pos_config.iface_cashdrawer;
                     self.iface_invoicing           =  !!pos_config.iface_invoicing;
+                    self.iface_big_scrollbars      =  !!pos_config.iface_big_scrollbars;
 
                     return self.fetch('stock.warehouse',[],[['id','=',pos_config.warehouse_id[0]]]);
                 }).then(function(shops){
index ae848ac..78f9073 100644 (file)
@@ -495,6 +495,17 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
             this.set_weight(0);
             this.renderElement();
 
+            this.hotkey_handler = function(event){
+                if(event.which === 13){
+                    self.order_product();
+                    self.pos_widget.screen_selector.set_current_screen(self.next_screen);
+                }else if(event.which === 27){
+                    self.pos_widget.screen_selector.set_current_screen(self.previous_screen);
+                }
+            };
+
+            $('body').on('keyup',this.hotkey_handler);
+
             this.add_action_button({
                     label: _t('Back'),
                     icon: '/point_of_sale/static/src/img/icons/png48/go-previous.png',
@@ -560,6 +571,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
         close: function(){
             var self = this;
             this._super();
+            $('body').off('keyup',this.hotkey_handler);
 
             this.pos.proxy_queue.clear();
             this.pos.proxy_queue.schedule(function(){
@@ -662,6 +674,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
                     icon: '/point_of_sale/static/src/img/icons/png48/go-previous.png',
                     click: function(){  
                        self.queue.schedule(self.cancel);
+                       self.pos_widget.screen_selector.set_current_screen(self.previous_screen);
                     }
                 });
         },
@@ -681,6 +694,13 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
 
         show_numpad:     false,
         show_leftpane:   false,
+        start: function(){
+            this._super();
+            $('.goodbye-message').click(function(){
+                $(this).addClass('oe_hidden');
+            });
+        },
+
         barcode_product_action: function(code){
             this.pos.proxy.transaction_start();
             this._super(code);
@@ -871,6 +891,17 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
             this._super();
             var self = this;
 
+            this.hotkey_handler = function(event){
+                if(event.which === 13){
+                    self.validateCurrentOrder();
+                }else if(event.which === 27){
+                    self.back();
+                }
+            };
+
+            $('body').on('keyup',this.hotkey_handler);
+
+
             if(this.pos.iface_cashdrawer){
                 this.pos.proxy.open_cashbox();
             }
@@ -881,12 +912,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
                     label: _t('Back'),
                     icon: '/point_of_sale/static/src/img/icons/png48/go-previous.png',
                     click: function(){  
-                        _.each(self.paymentlinewidgets, function(widget){
-                            if( widget.payment_line.get_amount() === 0 ){
-                                widget.payment_line.destroy();
-                            }
-                        });
-                        self.pos_widget.screen_selector.set_current_screen(self.back_screen);
+                        self.back();
                     },
                 });
 
@@ -917,9 +943,15 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
             this._super();
             this.pos_widget.order_widget.set_numpad_state(null);
             this.pos_widget.payment_screen.set_numpad_state(null);
+            $('body').off('keyup',this.hotkey_handler);
         },
         back: function() {
-            this.pos_widget.screen_selector.set_current_screen(self.back_screen);
+            _.each(this.paymentlinewidgets, function(widget){
+                if( widget.payment_line.get_amount() === 0 ){
+                    widget.payment_line.destroy();
+                }
+            });
+            this.pos_widget.screen_selector.set_current_screen(this.back_screen);
         },
         validateCurrentOrder: function(options) {
             var self = this;
@@ -927,6 +959,9 @@ 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()){
+                return;
+            }
 
             if(options.invoice){
                 // deactivate the validation button while we try to send the order
index 22245b3..2544b1b 100644 (file)
@@ -70,21 +70,24 @@ function openerp_pos_keyboard(instance, module){ //module is instance.point_of_s
         // Clears the content of the input zone.
         deleteAllCharacters: function(){
             var $input = this.$target;
-            $input[0].value = "";
-            $input.keydown();
-            $input.keyup();
+            if($input[0].value){
+                $input[0].value = "";
+                $input.keydown();
+                $input.keyup();
+            }
         },
 
         // Makes the keyboard show and slide from the bottom of the screen.
         show:  function(){
-            $('.keyboard_frame').show().animate({'height':'235px'}, 500, 'swing');
+            $('.keyboard_frame').show().css({'height':'235px'});
         },
         
         // Makes the keyboard hide by sliding to the bottom of the screen.
         hide:  function(){
-            var self = this;
-            var frame = $('.keyboard_frame');
-            frame.animate({'height':'0'}, 500, 'swing', function(){ frame.hide(); self.reset(); });
+            $('.keyboard_frame')
+                .css({'height':'0'})
+                .hide();
+            this.reset();
         },
         
         //What happens when the shift key is pressed : toggle case, remove capslock
index 0b3c1bc..68c7b97 100644 (file)
@@ -546,7 +546,6 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
 
             // filter the products according to the search string
             this.$('.searchbox input').keyup(function(event){
-                console.log('event',event);
                 query = $(this).val().toLowerCase();
                 if(query){
                     if(event.which === 13){
@@ -842,6 +841,10 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
 
                 self.build_widgets();
 
+                if(self.pos.iface_big_scrollbars){
+                    self.$el.addClass('big-scrollbars');
+                }
+
                 self.screen_selector.set_default_screen();