AmpersandHQ / magento2-disable-stock-reservation

This module disables the inventory reservation logic introduced as part of MSI in Magento 2.3.3
GNU Lesser General Public License v3.0
211 stars 60 forks source link

Canceled item restored to wrong stock source #112

Closed barryvdh closed 1 year ago

barryvdh commented 1 year ago

When there are multiple stock sources, it seems to occur that the stock is returned to a different stock source then before.

Tested with a grouped product, with a simple product with multiple stock Stock A = 2 Stock B = 3

Create a pending order with qty 5 Stock A = 0 Stock B = 0

Cancel the order Stock A = 0 Stock B = 5

When we now update the stock A with the API (eg from the ERP), the total QTY is incorrect.

Other case is: default = 0 Stock A = 5 Stock B = 0

Order qty 4 (so all from A) -> Stock A = 1 Cancel order -> All are returned to Stock B instead of A so new situation: default = 0 Stock A = 1 Stock B = 4

Any ideas how to fix this?

convenient commented 1 year ago

Hey @barryvdh

can you confirm the version of magento you're using?

barryvdh commented 1 year ago

2.4.5-p1

barryvdh commented 1 year ago

I'm not really sure where to look. Where is the stock source saved for an order? I can try to debug this case, but not really sure where to start.

convenient commented 1 year ago

@barryvdh looks like https://github.com/AmpersandHQ/magento2-disable-stock-reservation/blob/master/src/etc/db_schema.xml defines order_sources

convenient commented 1 year ago

@barryvdh we have reproduced this issue and are continuing to debug.

convenient commented 1 year ago

@barryvdh please see https://github.com/AmpersandHQ/magento2-disable-stock-reservation/pull/113 there's some WIP going on there, please give feedback on that PR if you have any

barryvdh commented 1 year ago

Thanks, I did a quick test and that seems to fix it. Edit: Some issues though, commented.