From 8e720a9319317217fa39c3be982b41072fcd479a Mon Sep 17 00:00:00 2001 From: Joren Van Onder Date: Tue, 27 Sep 2016 16:00:27 +0200 Subject: [PATCH 1/2] [FIX] point_of_sale: delete validated orders immediately from db If you validate an order it will be sent to the backend. If you then close the POS frontend somehow before clicking 'Next order' this order will be reloaded from localStorage when reopening it. This is problematic because it allows the user to then modify this order and validate it again. Everything will appear fine but in the backend this new, modified order will be ignored as it has the same pos_reference as the one that was sent initially. The deeper underlying issue is that there exists a brief timeframe where the same order can exist twice in the db: both as 'order' and 'unpaid_order'. To ensure this does not happen this fix removes the order from the unpaid orders after it is saved as a validated order. Fixes #13538 --- addons/point_of_sale/static/src/js/db.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/point_of_sale/static/src/js/db.js b/addons/point_of_sale/static/src/js/db.js index e836060df43..91c8db8302f 100644 --- a/addons/point_of_sale/static/src/js/db.js +++ b/addons/point_of_sale/static/src/js/db.js @@ -412,6 +412,10 @@ openerp.point_of_sale.load_db = function load_db(instance, module){ } } + // Only necessary when we store a new, validated order. Orders + // that where already stored should already have been removed. + this.remove_unpaid_order(order); + orders.push({id: order_id, data: order}); this.save('orders',orders); return order_id; From 8e094bb8fdc15a55e96d748cb4314e20492d2b10 Mon Sep 17 00:00:00 2001 From: Nils Hamerlinck Date: Tue, 18 Oct 2016 17:17:41 -0700 Subject: [PATCH 2/2] [FIX] point_of_sale: return raises an irrelevant warning When returning an item by entering an orderline with a negative quantity you got a warning message asking you to confirm a large payment amount. Introduced by 5a3d9ce9ce6d806c8433d27541673033ab13d905. Closes #13777 --- addons/point_of_sale/static/src/js/screens.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index a20b5ea5df4..2353059568f 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -1814,7 +1814,7 @@ openerp.point_of_sale.load_screens = function load_screens(instance, module){ // } // if the change is too large, it's probably an input error, make the user confirm. - if (!force_validation && (order.get_total_with_tax() * 1000 < order.get_total_paid())) { + if (!force_validation && order.get_total_with_tax() > 0 && (order.get_total_with_tax() * 1000 < order.get_total_paid())) { this.gui.show_popup('confirm',{ title: _t('Please Confirm Large Amount'), body: _t('Are you sure that the customer wants to pay') +