Fix quantity misadjustment on status change from Canceled to any non-loggable #36123
+7
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
How to test?
1. Check the stock quantity for a selected product
2. Create an order for the selected product
Make sure the order is in a non-loggable state, such as Awaiting Bank Wire Payment. Check the stock quantity for the ordered product.
3. Change order status to Canceled or Payment error
Recheck the stock quantity for the ordered product. At this stage everything should be correct, the stock has returned to the state before the order was created.
4. Change order status to any non-loggable status for example Awaiting bank wire payment.
Expected behavior:
The amount of stock should return to the same as in the second step.
Behavior before bug fix:
The physical quantity was incorrectly increased by the quantity of ordered product.
5. Change order status again to Canceled or Payment error
Expected behavior:
The stock quantity should return to the same level as it was in the third step.
Behavior before bug fix:
Now you've somehow generated some additional stock :)