[FIX] pos_restaurant: delete table from ticket screen

When a table was deleted and the ticket screen was already loaded once with orders, if a table was deleted, the ticket screen cache would keep the tables recorded on the order.

Now, when a table is deleted, the ticketScreen cache is reseted.

This fix also delete the table from the list of the model.

closes odoo/odoo#97157

X-original-commit: 134c3228e02b3fbabdb411de872ff717a26a832e
Signed-off-by: Masereel Pierre <pim@odoo.com>
This commit is contained in:
rhe-odoo
2022-07-30 14:51:51 +02:00
committed by Pierre Masereel
parent 97517e8f01
commit 08b3862a82
@@ -336,6 +336,8 @@ odoo.define('pos_restaurant.FloorScreen', function (require) {
if (this.state.selectedTableId === originalSelectedTableId) {
this.state.selectedTableId = null;
}
delete this.env.pos.tables_by_id[originalSelectedTableId];
this.env.pos.TICKET_SCREEN_STATE.syncedOrders.cache = {};
} catch (error) {
if (isConnectionError(error)) {
await this.showPopup('OfflineErrorPopup', {