[FIX] point_of_sale: correctly handle various xmlrpc errors that appear in offline...
authorFrédéric van der Essen <fvdessen@gmail.com>
Mon, 1 Dec 2014 14:46:29 +0000 (15:46 +0100)
committerFrédéric van der Essen <fvdessen@gmail.com>
Mon, 1 Dec 2014 14:46:29 +0000 (15:46 +0100)
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/widgets.js

index 3d956db..fb7a0ee 100644 (file)
@@ -440,7 +440,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
                     } else {
                         def.reject();
                     }
-                }, function(){ def.reject(); });    
+                }, function(err,event){ event.preventDefault(); def.reject(); });    
             return def;
         },
 
index 88d04a8..ed7110c 100644 (file)
@@ -751,6 +751,12 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
 
             new instance.web.Model('res.partner').call('create_from_ui',[fields]).then(function(partner_id){
                 self.saved_client_details(partner_id);
+            },function(err,event){
+                event.preventDefault();
+                self.pos_widget.screen_selector.show_popup('error',{
+                    'message':_t('Error: Could not Save Changes'),
+                    'comment':_t('Your Internet connection is probably down.'),
+                });
             });
         },
         
index 8e02ddd..6aaf732 100644 (file)
@@ -1233,6 +1233,13 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
                 self.pos.push_order().then(function(){
                     return new instance.web.Model("ir.model.data").get_func("search_read")([['name', '=', 'action_client_pos_menu']], ['res_id']).pipe(function(res) {
                         window.location = '/web#action=' + res[0]['res_id'];
+                    },function(err,event) {
+                        event.preventDefault();
+                        self.screen_selector.show_popup('error',{
+                            'message': _t('Could not close the point of sale.'),
+                            'comment': _t('Your internet connection is probably down.'),
+                        });
+                        self.close_button.renderElement();
                     });
                 });
             }