[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) <jcb@odoo.com>
This commit is contained in:
Pedram (pebr)
2024-04-23 15:32:54 +00:00
parent d143d01287
commit dcdef39697
@@ -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)
);