From a1839fb305b872632791be11bc481d591b58c395 Mon Sep 17 00:00:00 2001 From: Gert Pellin <gpe@odoo.com> Date: Tue, 12 Nov 2019 10:06:13 +0000 Subject: [PATCH] [FIX] pos_restaurant: sync empty orders * In a pos-session with table management create a new order with products and go back to the floor-plan. * The order is sinced to the back-end. * Open the table again, remove all products but keep the order. * Go back to floorplan to trigger syncing again. * Open the table again. behaviour before fix: * The empty order is not loaded in the frontend anymore. * To close the session the order has to be manually removed in the backend. After fix: * The order is still visible in the frontend and can be removed or finalysed as expected. closes odoo/odoo#40165 X-original-commit: 3add8dd226f39d5166873a575b858694eeb2e6ee Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com> --- addons/pos_restaurant/static/src/js/floors.js | 8 +++--- .../static/src/js/tours/pos_restaurant.js | 26 +++++++++++++++++++ 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/addons/pos_restaurant/static/src/js/floors.js b/addons/pos_restaurant/static/src/js/floors.js index f87978708e24..aeda7259ba98 100644 --- a/addons/pos_restaurant/static/src/js/floors.js +++ b/addons/pos_restaurant/static/src/js/floors.js @@ -959,11 +959,9 @@ models.PosModel = models.PosModel.extend({ } }); server_orders.forEach(function(server_order){ - if (server_order.lines.length){ - var new_order = new models.Order({},{pos: self, json: server_order}); - self.get("orders").add(new_order); - new_order.save_to_db(); - } + var new_order = new models.Order({},{pos: self, json: server_order}); + self.get("orders").add(new_order); + new_order.save_to_db(); }) if (!ids_to_remove.length) { self.set_synch('connected'); diff --git a/addons/pos_restaurant/static/src/js/tours/pos_restaurant.js b/addons/pos_restaurant/static/src/js/tours/pos_restaurant.js index a59f2d6caaf7..9e112e3d34c6 100644 --- a/addons/pos_restaurant/static/src/js/tours/pos_restaurant.js +++ b/addons/pos_restaurant/static/src/js/tours/pos_restaurant.js @@ -201,6 +201,32 @@ odoo.define('pos_reataurant.tour.synchronized_table_management', function (requi // Test transfering an empty order steps = steps.concat(transfer_order_to_table('T4', '2')); + steps = steps.concat(add_product_to_order('Coca-Cola')); + steps = steps.concat(verify_order_total('2.20')); + + // Take a synced order with products, remove the products + // and check if the order is still available in the front-end + steps = steps.concat([{ + content: 'back to floor', + trigger: '.floor-button', + run: 'click', + }]); + steps = steps.concat(open_table('T4', 1)); + steps = steps.concat([{ + content: 'click backspace to set quantity to 0', + trigger: '.numpad-backspace', + run: 'click', + }, { + content: 'click backspace to remove line', + trigger: '.numpad-backspace', + run: 'click', + }]); + steps = steps.concat([{ + content: 'back to floor', + trigger: '.floor-button', + run: 'click', + }]); + steps = steps.concat(open_table('T4', 1)); steps = steps.concat(add_product_to_order('Coca-Cola')); steps = steps.concat(verify_order_total('2.20')); steps = steps.concat([{ -- GitLab