[WIP] point_of_sale: checking for consistency between the user and the session's...
authorFrederic van der Essen <fva@openerp.com / fvdessen+o@gmail.com>
Wed, 3 Sep 2014 12:28:17 +0000 (14:28 +0200)
committerFrederic van der Essen <fva@openerp.com / fvdessen+o@gmail.com>
Mon, 8 Sep 2014 16:06:51 +0000 (18:06 +0200)
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 9a8064a..f5b536b 100644 (file)
@@ -202,6 +202,10 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
                     'discount': self.config.barcode_discount,
                     'price':    self.config.barcode_price,
                 });
+
+                if (self.config.company_id[0] !== self.user.company_id[0]) {
+                    throw new Error(_t("Error: The Point of Sale User must belong to the same company as the Point of Sale. You are probably trying to load the point of sale as an administrator in a multi-company setup, with the administrator account set to the wrong company."));
+                }
             },
         },{
             model: 'stock.location',
index 215aa0f..a543cb8 100644 (file)
@@ -336,6 +336,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
                 if ( options.confirm ) {
                     options.confirm.call(self);
                 }
+            });
         },
         close:function(){
             this._super();
index 2418468..f7d2d1c 100644 (file)
@@ -1017,12 +1017,6 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
 
                 instance.webclient.set_content_full_screen(true);
 
-                if (!self.pos.session) {
-                    self.screen_selector.show_popup('error', 'Sorry, we could not create a user session');
-                }else if(!self.pos.config){
-                    self.screen_selector.show_popup('error', 'Sorry, we could not find any PoS Configuration for this session');
-                }
-            
                 self.$('.loader').animate({opacity:0},1500,'swing',function(){self.$('.loader').addClass('oe_hidden');});
 
                 self.pos.push_order();
@@ -1113,12 +1107,6 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
             this.error_barcode_popup = new module.ErrorBarcodePopupWidget(this, {});
             this.error_barcode_popup.appendTo(this.$el);
 
-            this.choose_receipt_popup = new module.ChooseReceiptPopupWidget(this, {});
-            this.choose_receipt_popup.appendTo(this.$el);
-
-            this.error_invoice_transfer_popup = new module.ErrorInvoiceTransferPopupWidget(this, {});
-            this.error_invoice_transfer_popup.appendTo(this.$el);
-
             this.error_traceback_popup = new module.ErrorTracebackPopupWidget(this,{});
             this.error_traceback_popup.appendTo(this.$el);