From 5c27b57ef9bd79d87968dba78b72518bdffb5129 Mon Sep 17 00:00:00 2001 From: "Nasreddin (bon)" Date: Wed, 7 Oct 2020 08:56:34 +0000 Subject: [PATCH] [FIX] pos_restaurant: Error when adding product after printing the bill Issue - Install "Point of sale" - Create a new one. - Activate the "Is a Bar/Restaurant" feature and save - Activate the "Bill Printing" feature then save - Start a new session - Add a product A - Click on "Bill" then "Print" - Then click on "Ok" to go back to order - Add a product B Error is raised ("Cannot read property 'add_product' of null"). Cause Trying to add a product to an order who is destroyed if the bill has been printed. Solution If the bill is printed (and not the receipt), set '_printed' of the current order to 'false', therefore it will add the product to the current order. opw-2341115 closes odoo/odoo#59465 X-original-commit: 6683a9929d68be956854000fa9b3e9f99ceecdfb Signed-off-by: bon-odoo --- .../static/src/js/Screens/ReceiptScreen/ReceiptScreen.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/pos_restaurant/static/src/js/Screens/ReceiptScreen/ReceiptScreen.js b/addons/pos_restaurant/static/src/js/Screens/ReceiptScreen/ReceiptScreen.js index 689c3bf40ca..3976eb4e270 100644 --- a/addons/pos_restaurant/static/src/js/Screens/ReceiptScreen/ReceiptScreen.js +++ b/addons/pos_restaurant/static/src/js/Screens/ReceiptScreen/ReceiptScreen.js @@ -20,6 +20,13 @@ odoo.define('pos_restaurant.ReceiptScreen', function(require) { return super.nextScreen; } } + /** + * @override + */ + async _printWeb() { + await super._printWeb(); + this.currentOrder._printed = false; + } }; Registries.Component.extend(ReceiptScreen, PosResReceiptScreen);