Kaynağa Gözat

fix(core): Fix incorrect allocation logic in default fulfillment process

Fixes #2306
Michael Bromley 2 yıl önce
ebeveyn
işleme
f6881bf307

+ 4 - 1
packages/core/src/config/fulfillment/default-fulfillment-process.ts

@@ -89,7 +89,10 @@ export const defaultFulfillmentProcess: FulfillmentProcess<FulfillmentState> = {
     },
     async onTransitionEnd(fromState, toState, { ctx, fulfillment, orders }) {
         if (toState === 'Cancelled') {
-            const orderLineInput = fulfillment.lines.map(l => ({ orderLineId: l.id, quantity: l.quantity }));
+            const orderLineInput = fulfillment.lines.map(l => ({
+                orderLineId: l.orderLineId,
+                quantity: l.quantity,
+            }));
             await stockMovementService.createCancellationsForOrderLines(ctx, orderLineInput);
             // const lines = await groupOrderItemsIntoLines(ctx, orderLineInput);
             await stockMovementService.createAllocationsForOrderLines(ctx, orderLineInput);