medusajs / medusa

The world's most flexible commerce platform.
https://medusajs.com
MIT License
25.93k stars 2.6k forks source link

Error: Cannot remove Inventory Levels xxxx. , when select stock location in a inventory item page. #9154

Closed Attachai77 closed 1 month ago

Attachai77 commented 1 month ago

Bug report

Describe the bug

I'd like to manage & selected locations in inventory item page and submit , so I was getting an error below.

System information

Medusa version (including plugins): v2.0.9 Node.js version: v20.12.2 Database: Operating system: Browser (if relevant):

Steps to reproduce the behavior

  1. Go to 'Inventory Item page'
  2. Click on 'select a location and save'
  3. Scroll down to 'toast'
  4. See error

Expected behavior

It seem 3-4 days ago it worked.

Screenshots

Screenshot 2567-09-17 at 11 41 29

more error

error:   Cannot remove Inventory Levels for sloc_01J57Q89ZK9HWJQP07W9ERKNS5 because there are stocked or reserved items at the locations
{
  message: 'Cannot remove Inventory Levels for sloc_01J57Q89ZK9HWJQP07W9ERKNS5 because there are stocked or reserved items at the locations',
  name: 'Error',
  stack: 'Error: Cannot remove Inventory Levels for sloc_01J57Q89ZK9HWJQP07W9ERKNS5 because there are stocked or reserved items at the locations\n' +
    '    at Object.<anonymous> (/app/medusa/node_modules/@medusajs/core-flows/dist/inventory/workflows/delete-inventory-levels.js:15:15)\n' +
    '    at Object.invoke (/app/medusa/node_modules/@medusajs/workflows-sdk/src/utils/composer/helpers/create-step-handler.ts:58:67)\n' +
    '    at processTicksAndRejections (node:internal/process/task_queues:95:5)\n' +
    '    at async DistributedTransaction.handler (/app/medusa/node_modules/@medusajs/orchestration/src/workflow/workflow-manager.ts:214:16)\n' +
    '    at async Promise.allSettled (index 0)\n' +
    '    at async promiseAll (/app/medusa/node_modules/@medusajs/utils/src/common/promise-all.ts:23:18)\n' +
    '    at async TransactionOrchestrator.executeNext (/app/medusa/node_modules/@medusajs/orchestration/src/transaction/transaction-orchestrator.ts:856:7)\n' +
    '    at async TransactionOrchestrator.resume (/app/medusa/node_modules/@medusajs/orchestration/src/transaction/transaction-orchestrator.ts:901:5)\n' +
    '    at async LocalWorkflow.run (/app/medusa/node_modules/@medusajs/orchestration/src/workflow/local-workflow.ts:370:5)\n' +
    '    at async originalExecution (/app/medusa/node_modules/@medusajs/workflows-sdk/src/helper/workflow-export.ts:105:25)',
  __isMedusaError: true,
  type: 'not_allowed',
  code: undefined,
  date: 2024-09-17T04:27:13.585Z
}

Additional info

olivermrbl commented 1 month ago

@Attachai77, nice catch. We'll patch this asap :)