magento / inventory

Magento Inventory Project (a.k.a MSI)
Open Software License 3.0
336 stars 247 forks source link

Credit Memo > Return To Stock > Items stay out of stock #3387

Open codebase-md opened 1 year ago

codebase-md commented 1 year ago

Preconditions (*)

  1. Magento 2.4.5-p2 with Inventory version 1.2.3
  2. No backorders or else
  3. Manage stock enabled

Steps to reproduce (*)

  1. Buy the maximum amount possible of a product so it gets status out of stock
  2. Complete the order handling process until order status is complete
  3. Create a credit memo for the whole amount > tick "Return To Stock"

Expected result (*)

  1. Product should change stock status to "in stock" after quantity is added back and saleable quantity is calculated

Actual result (*)

  1. Product stays out of stock

Additional Info

I debugged this process and traced it back to following code: SourceDeductionService

I don't understand the semantics here. Why is the current status(in other words old status) of the legacy stock item relevant if the actual stock status is already calculated. Additionally stock status of legacy stock item is not updated at this point. That follows later via plugin and relies on the stock status of the source item which in turn relies on the stock status of the legacy stock item before it gets updated.

This is particularly annoying since it produces additional work. After every refund (of the described kind) I have to change stock status manually. This also bears the risk that I forget to do that. Product stays out of stock, catalog becomes smaller and smaller.(just a worse case scenario)

m2-assistant[bot] commented 1 year ago

Hi @codebase-md. Thank you for your report. To speed up processing of this issue, make sure that you provided sufficient information. Add a comment to assign the issue: @magento I am working on this


Join Magento Community Engineering Slack and ask your questions in #github channel.