[FIX] point_of_sale: display an error when trying to print a receipt on an outdated...
authorFrederic van der Essen <fva@openerp.com / fvdessen+o@gmail.com>
Tue, 9 Sep 2014 14:14:27 +0000 (16:14 +0200)
committerFrederic van der Essen <fva@openerp.com / fvdessen+o@gmail.com>
Tue, 9 Sep 2014 14:17:26 +0000 (16:17 +0200)
addons/point_of_sale/static/src/js/devices.js

index 23dc898..71dfb10 100644 (file)
@@ -1,5 +1,6 @@
 
 function openerp_pos_devices(instance,module){ //module is instance.point_of_sale
+       var _t = instance.web._t;
 
     // the JobQueue schedules a sequence of 'jobs'. each job is
     // a function returning a deferred. the queue waits for each job to finish 
@@ -88,6 +89,8 @@ function openerp_pos_devices(instance,module){ //module is instance.point_of_sal
             var self = this;
             options = options || {};
             url = options.url || 'http://localhost:8069';
+
+            this.pos = parent;
             
             this.weighting = false;
             this.debug_weight = 0;
@@ -410,7 +413,14 @@ function openerp_pos_devices(instance,module){ //module is instance.point_of_sal
                     self.message('print_xml_receipt',{ receipt: r },{ timeout: 5000 })
                         .then(function(){
                             send_printing_job();
-                        },function(){
+                        },function(error){
+                            if (error) {
+                                self.pos.pos_widget.screen_selector.show_popup('error',{
+                                    'message': _t('PosBox Printing Error'),
+                                    'comment': _t("The receipt could not be printed. The software installed on the posbox is probably out of date. Please refer to the software instructions in the posbox manual or contact the customer support"),
+                                });
+                                return;
+                            }
                             self.receipt_queue.unshift(r)
                         });
                 }