fix(core-flows, dashboard): adjust stock levels when doing partial fulfilments (#9736)
* fix: correctly update stock location when partial fulfillemnt is created * fix: update test * fix: count reserved quantity of the item as available quantity for fulfillment * fix: refresh reservations when order fulfillment is created * feat: add check for reservation quantity * feat: add a test case
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { FetchError } from "@medusajs/js-sdk"
|
||||
import { AdminOrderItemsFilters, HttpTypes } from "@medusajs/types"
|
||||
import { HttpTypes } from "@medusajs/types"
|
||||
import {
|
||||
QueryKey,
|
||||
useMutation,
|
||||
@@ -10,6 +10,8 @@ import {
|
||||
import { sdk } from "../../lib/client"
|
||||
import { queryClient } from "../../lib/query-client"
|
||||
import { queryKeysFactory, TQueryKey } from "../../lib/query-key-factory"
|
||||
import { inventoryItemsQueryKeys } from "./inventory"
|
||||
import { reservationItemsQueryKeys } from "./reservations"
|
||||
|
||||
const ORDERS_QUERY_KEY = "orders" as const
|
||||
const _orderKeys = queryKeysFactory(ORDERS_QUERY_KEY) as TQueryKey<"orders"> & {
|
||||
@@ -156,6 +158,14 @@ export const useCreateOrderFulfillment = (
|
||||
queryKey: ordersQueryKeys.preview(orderId),
|
||||
})
|
||||
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: reservationItemsQueryKeys.lists(),
|
||||
})
|
||||
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: inventoryItemsQueryKeys.details(),
|
||||
})
|
||||
|
||||
options?.onSuccess?.(data, variables, context)
|
||||
},
|
||||
...options,
|
||||
|
||||
Reference in New Issue
Block a user