From dcdef396971cccb886cc694f6386e808de442678 Mon Sep 17 00:00:00 2001 From: "Pedram (pebr)" Date: Tue, 23 Apr 2024 09:57:27 +0200 Subject: [PATCH] [FIX] point_of_sale: Ensure order exists before reading state in refund Prior to this commit, there were scenarios where sync orders did not contain an order, leading to a failure when reading its state. This commit introduces a check to ensure the order exists in sync before its state is read, thereby preventing this error. opw-3856451 closes odoo/odoo#162943 Signed-off-by: Joseph Caburnay (jcb) --- .../static/src/app/screens/ticket_screen/ticket_screen.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/point_of_sale/static/src/app/screens/ticket_screen/ticket_screen.js b/addons/point_of_sale/static/src/app/screens/ticket_screen/ticket_screen.js index ce44051cf00..20a3eb244ca 100644 --- a/addons/point_of_sale/static/src/app/screens/ticket_screen/ticket_screen.js +++ b/addons/point_of_sale/static/src/app/screens/ticket_screen/ticket_screen.js @@ -276,7 +276,7 @@ export class TicketScreen extends Component { const invoicedOrderIds = new Set( allToRefundDetails - .filter(detail => this._state.syncedOrders.cache[detail.orderline.orderBackendId].state === "invoiced") + .filter(detail => this._state.syncedOrders.cache[detail.orderline.orderBackendId]?.state === "invoiced") .map(detail => detail.orderline.orderBackendId) );