magento / inventory

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

Partial Refunds on orders pre-shipment generate return to stock reservations, but order can't be shipped, leading to stock issues #3329

Open IanFiretoys opened 2 years ago

IanFiretoys commented 2 years ago

Preconditions (*)

  1. magento 2.4.3 with MSI enabled (also 2.4.2)
  2. order for multiple products,

Steps to reproduce (*)

  1. refund an incomplete amount of one item in the order (ie. if 6 duffel bags in green were ordered, refund 4 of them but allow the rest of the order to remain)
  2. tick return to stock checkbox
  3. attempt to ship/complete the order

Expected result (*)

  1. shipment is generated, order status is changed to complete
  2. all reservations for products in the order are generated, stock returns to the on-the-shelf level

Actual result (*)

  1. shipment is generated, but order stays in pending state, positive reservations are generated for all products not refunded (+2 for green duffel as shipment_created metadata for refunded product, and full reservations for all other items)
  2. inventory reservations are generated correctly by the refund/return to stock (+4 for green duffel on inventory_reservation as credit_memo)
  3. more reservations are generated every time the user tries to refund the items again, if they think that will close the order (this won't happen every time though)
  4. eventually you have to ship the refunded items as a separate item to move the order status, also generating another reservation (+4 for green duffel on inventory reservation as shipment_created)
  5. the item in question then has more positive than negative reservations leading to saleable qty being higher than actual stock qty
m2-assistant[bot] commented 2 years ago

Hi @IanFiretoys. 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