[IMP] point_of_sale: show traceback popup when there is a server error when posting orders (which should NEVER happen !)

This commit is contained in:
Frederic van der Essen 2014-07-22 14:33:32 +02:00
parent 8e212eb6fb
commit 85d697670c
6 changed files with 36 additions and 1 deletions

View File

@ -553,6 +553,7 @@ class pos_order(osv.osv):
orders_to_save = [o for o in orders if o['data']['name'] not in existing_references]
order_ids = []
for tmp_order in orders_to_save:
to_invoice = tmp_order['to_invoice']
order = tmp_order['data']

View File

@ -1665,6 +1665,13 @@ td {
font-size: 18px;
margin: 0px 16px;
}
.pos .popup .comment.traceback {
height: 264px;
overflow: auto;
font-size: 14px;
text-align: left;
font-family: 'Inconsolata';
}
.pos .popup .footer{
position:absolute;
bottom:0;

View File

@ -451,7 +451,13 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
self.db.remove_order(order.id);
});
return server_ids;
}).fail(function (unused, event){
}).fail(function (error, event){
if(error.code === 200 ){ // Business Logic Error, not a connection problem
self.pos_widget.screen_selector.show_popup('error-traceback',{
message: error.data.message,
comment: error.data.debug
});
}
// prevent an error popup creation by the rpc failure
// we want the failure to be silent as we send the orders in the background
event.preventDefault();

View File

@ -367,6 +367,9 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
},
});
module.ErrorTracebackPopupWidget = module.ErrorPopupWidget.extend({
template:'ErrorTracebackPopupWidget',
});
module.ErrorSessionPopupWidget = module.ErrorPopupWidget.extend({
template:'ErrorSessionPopupWidget',

View File

@ -1082,6 +1082,9 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
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);
this.confirm_popup = new module.ConfirmPopupWidget(this,{});
this.confirm_popup.appendTo(this.$el);
@ -1139,6 +1142,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
'choose-receipt': this.choose_receipt_popup,
'error-no-client': this.error_no_client_popup,
'error-invoice-transfer': this.error_invoice_transfer_popup,
'error-traceback': this.error_traceback_popup,
'confirm': this.confirm_popup,
},
default_screen: 'products',

View File

@ -635,6 +635,20 @@
</div>
</t>
<t t-name="ErrorTracebackPopupWidget">
<div class="modal-dialog">
<div class="popup popup-error">
<p class="message"><t t-esc=" widget.message || 'Error' " /></p>
<p class="comment traceback"><t t-esc=" widget.comment || '' "/></p>
<div class="footer">
<div class="button">
Ok
</div>
</div>
</div>
</div>
</t>
<t t-name="ErrorBarcodePopupWidget">
<div class="modal-dialog">
<div class="popup popup-barcode">