[IMP] point_of_sale: add a debug option to delete all unsent orders

This commit is contained in:
Frederic van der Essen
2014-08-05 14:07:23 +02:00
parent 584a78a82b
commit ad0f710fe7
3 changed files with 14 additions and 0 deletions
+3
View File
@@ -345,6 +345,9 @@ function openerp_pos_db(instance, module){
});
this.save('orders',orders);
},
remove_all_orders: function(){
this.save('orders',[]);
},
get_orders: function(){
return this.load('orders',[]);
},
@@ -800,6 +800,16 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
this.$('.button.show_orders').click(function(){
self.pos.pos_widget.screen_selector.show_popup('unsent-orders');
});
this.$('.button.delete_orders').click(function(){
self.pos.pos_widget.screen_selector.show_popup('confirm',{
message: _t('Delete Unsent Orders ?'),
comment: _t('This operation will permanently destroy all unsent orders from the local storage. You will lose all the data. This operation cannot be undone.'),
confirm: function(){
self.pos.db.remove_all_orders();
self.pos.set({synch: { state:'connected', pending: 0 }});
},
});
});
_.each(this.eans, function(ean, name){
self.$('.button.'+name).click(function(){
self.$('input.ean').val(ean);
@@ -819,6 +819,7 @@
<p class="category">Unsent Orders</p>
<ul>
<li class="button show_orders">Show All Unsent Orders</li>
<li class="button delete_orders">Delete All Unsent Orders</li>
</ul>
<p class="category">Hardware Status</p>