magento / inventory

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

Salable quantity issue: After deleting a product, its entry is still present in the inventory_reservation table. #3373

Open Varshal24 opened 1 year ago

Varshal24 commented 1 year ago

Preconditions (*)

Tested on this versions:

  1. Magento 2.4.3-p1
  2. Magento 2.4.5-p1

Description (*)

When we placed order for any product than order_placed entry is being generated in inventory_reservation table. After that if we delete that product and create order shipment of that order than shipment is successfully generated. But we do not have the product now so the entry of order_placed in inventory_reservation table have to be delete automatic or by using inventory_cleanup_reservation cron but it is now deleting. So now if we create same sku product again and save it than we can see that salable quantity is lesser than the actual quantity we set into the product because same sku name is already stored as order_placed in inventory_reservation table, So it is counting minus in salable quantity in new product. This is causing a salable quantity issue.

Steps to reproduce (*)

  1. Create two simple products
  2. Order it both of these products
  3. Delete one product from the backend
  4. Create shipment for that order
  5. Open the database and check inventory_reservation table

image

Expected result (*)

  1. When we delete one product from the backend than the entry order_placed of that product will also have to be delete from the inventory_reservation table

image

  1. When the order_placed entry was removed from the inventory_reservation table and then if we create a new product with same sku than salable quantity have to set as the default quantity.

image

  1. As we can see here the salable quantity is same as per the quantity I have set here.

image

Actual result (*)

  1. After deleting one product, the order_placed entry in inventory_reservation table is still showing.
  2. If we create new product with same sku which we have deleted before than it is taking less salable quantity because the entry of order_placed of deleted product is still in inventory_reservation table
m2-assistant[bot] commented 1 year ago

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