spree/spree — Issue #911: Shipment adjustments not removed when shipment is destroyed
Author: r3ap3r2004
Created: 2011-12-27 01:35:25+00:00
State: open

Steps to reproduce.
1) Place an order
2) Go to the admin section and view the order
3) Go to the payment section and capture the payment for the order
4) Go to the shipping section and 'Ship' the order.
5) View the order shipments.
6) Delete the aforementioned Shipment.
7) Go to the adjustment section, note that the shipment adjustment is still there.

The real problem is that the adjustment is still in the database, but now points to a non-existant shipment.

If I create multiple shipments, and then decide to delete one of them (even before actually firing the 'ship' event for that shipment) then the adjustments show multiple shipping costs with no indication of which shipment is actually still in the database. When I go to delete one of the adjustments (as to not charge the customer for a shipment that isn't being made) then in all likelihood I would actually delete the wrong one. Now I have 2 inconsistencies in the database data.

If there is a logical reason to keep the adjustment in the database then there needs to be a way to identify which of the adjustments is tied to the now deleted shipment so that the store owner can delete the appropriate entry.

If there isn't a logical reason to keep the adjustment (which is my belief) then the adjustment needs to be deleted and the order updated to reflect the fact that an adjustment was removed.