diff --git a/addons/point_of_sale/static/src/js/db.js b/addons/point_of_sale/static/src/js/db.js index 38230fb0ca2..08d4f879968 100644 --- a/addons/point_of_sale/static/src/js/db.js +++ b/addons/point_of_sale/static/src/js/db.js @@ -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',[]); }, diff --git a/addons/point_of_sale/static/src/js/widgets.js b/addons/point_of_sale/static/src/js/widgets.js index ddc08545bea..d686a29785d 100644 --- a/addons/point_of_sale/static/src/js/widgets.js +++ b/addons/point_of_sale/static/src/js/widgets.js @@ -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); diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml index 45f567f0be7..5946133086c 100644 --- a/addons/point_of_sale/static/src/xml/pos.xml +++ b/addons/point_of_sale/static/src/xml/pos.xml @@ -819,6 +819,7 @@

Unsent Orders

Hardware Status