Sylius version affected: 1.7 and appears unfixed in master
Description
If you partially refund an order and then attempt to cancel it (for example you refunded the items but not the shipping) you get InvalidArgumentException "Not enough units to decrease on hold quantity from the inventory of a variant". But it should not be attempting to release the hold, because the hold was already released when the order was paid.
Steps to reproduce
- Place an order with a tracked product
- Complete the payment
- View the order in admin, refund part of the payment
- Cancel the order, get exception
Possible Solution
Account for OrderPaymentStates::STATE_PARTIALLY_REFUNDED in OrderInventoryOperator::cancel()