fix(core-flows, dashboard): reservation recreation on fulfilment cancel + allocation button display (#12447)

**What**
- fix recreation of reservations on fulfilment cancel
- fix allocate items button display

---

CLOSES CMRC-1018
This commit is contained in:
Frane Polić authored and GitHub committed 2025-05-12 17:09:23 +00:00
1 parent 728c350c0d
commit 39e5eadefc
5 files changed
+258 -10

No files matched your search

@@ -220,6 +220,14 @@ export const useCancelOrderFulfillment = (
queryKey: ordersQueryKeys.preview(orderId),
})
queryClient.invalidateQueries({
queryKey: reservationItemsQueryKeys.lists(),
})
queryClient.invalidateQueries({
queryKey: inventoryItemsQueryKeys.details(),
})
options?.onSuccess?.(data, variables, context)
},
...options,
@@ -114,7 +114,7 @@ export const OrderSummarySection = ({ order }: OrderSummarySectionProps) => {
}
return false
}, [reservations])
}, [order.items, reservations])
const unpaidPaymentCollection = order.payment_collections.find(
(pc) => pc.status === "not_paid"
@@ -203,6 +203,7 @@ function prepareInventoryUpdate({
inventory_item_id: string
location_id: string
quantity: BigNumberInput
line_item_id: string
}[] = []
const toUpdate: {
id: string
@@ -236,6 +237,7 @@ function prepareInventoryUpdate({
inventory_item_id: iitem.inventory.id,
location_id: fulfillment.location_id,
quantity: fulfillmentItem.quantity, // <- this is the inventory quantity that is being fulfilled so it menas it does include the required quantity
line_item_id: fulfillmentItem.line_item_id as string,
})
} else {
toUpdate.push({
@@ -338,7 +340,7 @@ export const cancelOrderFulfillmentWorkflow = createWorkflow(
"location_id",
],
variables: {
filter: {
filters: {
line_item_id: lineItemIds,
},
},