From 53cde4f7f430fc056711142221d1c504c1b063d9 Mon Sep 17 00:00:00 2001 From: Frederic van der Essen Date: Wed, 3 Sep 2014 14:28:17 +0200 Subject: [PATCH] [WIP] point_of_sale: checking for consistency between the user and the session's company --- addons/point_of_sale/static/src/js/models.js | 4 ++++ addons/point_of_sale/static/src/js/screens.js | 1 + addons/point_of_sale/static/src/js/widgets.js | 12 ------------ 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index 9a8064a7bba..f5b536b3c0e 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -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', diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index 215aa0f1ab6..a543cb8fc36 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -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(); diff --git a/addons/point_of_sale/static/src/js/widgets.js b/addons/point_of_sale/static/src/js/widgets.js index 2418468f3d2..f7d2d1c8086 100644 --- a/addons/point_of_sale/static/src/js/widgets.js +++ b/addons/point_of_sale/static/src/js/widgets.js @@ -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);