[WIP] point_of_sale: checking for consistency between the user and the session's company

This commit is contained in:
Frederic van der Essen 2014-09-03 14:28:17 +02:00
parent dc8e18ac04
commit 53cde4f7f4
3 changed files with 5 additions and 12 deletions

View 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',

View 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();

View 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);