[IMP] point_of_sale: only open cashbox when paying with cash + add manual override
authorFrédéric van der Essen <fva@openerp.com>
Tue, 12 Nov 2013 15:10:41 +0000 (16:10 +0100)
committerFrédéric van der Essen <fva@openerp.com>
Tue, 12 Nov 2013 15:10:41 +0000 (16:10 +0100)
bzr revid: fva@openerp.com-20131112151041-3betwjahh9ph9vx5

addons/point_of_sale/static/src/img/open-cashbox.png [new file with mode: 0644]
addons/point_of_sale/static/src/js/screens.js

diff --git a/addons/point_of_sale/static/src/img/open-cashbox.png b/addons/point_of_sale/static/src/img/open-cashbox.png
new file mode 100644 (file)
index 0000000..1e07b0a
Binary files /dev/null and b/addons/point_of_sale/static/src/img/open-cashbox.png differ
index 77a542f..01ccd53 100644 (file)
@@ -873,8 +873,8 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
             this._super();
             var self = this;
 
-            if(this.pos.iface_cashdrawer){
-                this.pos.proxy.open_cashbox();
+            if( this.pos.iface_cashdrawer && this.pos.get('selectedOrder').get('paymentLines').find(                function(pl){ return pl.cashregister.get('journal').type === 'cash'; })){
+                    this.pos.proxy.open_cashbox();
             }
 
             this.set_numpad_state(this.pos_widget.numpad.state);
@@ -912,6 +912,17 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
                     });
             }
 
+            if( this.pos.iface_cashdrawer ){
+                this.add_action_button({
+                        label: _t('Cash'),
+                        name: 'cashbox',
+                        icon: '/point_of_sale/static/src/img/open-cashbox.png',
+                        click: function(){
+                            self.pos.proxy.open_cashbox();
+                        },
+                    });
+            }
+
             this.updatePaymentSummary();
             this.line_refocus();
         },