You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
When I cancel and order, the inventory units remain on_hand
# Canceled order
order.inventory_units.pluck(:state) => ["on_hand"]
Steps to recreate
Create an order and complete it
Cancel the order by clicking the "Cancel" button
Notice that the order state is canceled, the shipment state it canceled, but the inventory units states remain on_hand (see screenshot below)
Describe the solution you'd like
When I cancel an order, the inventory units state should also change to canceled
# Desired return for canceled order
order.inventory_units.pluck(:state) => ["canceled"]`
Describe alternatives you've considered
Additional context
The issue we've specifically had has been with our warehouse system. The inventory units have to be canceled so our CSRs have to cancel and order, and cancel all the items under the "Cancel Items" tab. But it does seem strange that when you cancel an order the inventory units are not also canceled. We set the shipment state to cancelled so I would assume we do the same for the inventory units.
The text was updated successfully, but these errors were encountered:
I think it's a good concern and before an in-depth investigation about why is currently this way, I think you are right: we should cancel (and restock?) inventory units when the order is canceled.
I've investigated this issue a bit, here are my findings:
The stocks' level after an order cancelation is maintained thanks to the Spree::ShippingManifest. When a Spree::Shipment is canceled it use the ShippingManifest to restock the items.
If an order is resumed, after it was canceled, the Shipment will take care to re-update the stocks' level correctly, using the Manifest as a source of truth.
In this process, the shipment's inventory_units stay untouched.
We can probably update the inventory_units state when we change the state of the Shipment.
Is possible that there are some corner cases when we resume an order that I'm not able to catch.
I can try to open a PR to see how the code would look like, and if we catch some corner cases with the tests.
Is your feature request related to a problem? Please describe.
When I cancel and order, the inventory units remain
on_hand
Steps to recreate
canceled
, the shipment state itcanceled
, but the inventory units states remainon_hand
(see screenshot below)Describe the solution you'd like
When I cancel an order, the inventory units state should also change to
canceled
Describe alternatives you've considered
Additional context
The issue we've specifically had has been with our warehouse system. The inventory units have to be canceled so our CSRs have to cancel and order, and cancel all the items under the "Cancel Items" tab. But it does seem strange that when you cancel an order the inventory units are not also canceled. We set the shipment state to cancelled so I would assume we do the same for the inventory units.
The text was updated successfully, but these errors were encountered: