Skip to content

Commit 593d11a

Browse files
committed
Ensure shipped shipments are "immutable"
At least, in terms of the state. We shouldn't mark shipped shipments as cancelled even if all of the items in the shipment get cancelled. If a shipment has been marked as shipped, then we need to preserve that state.
1 parent 5fd112a commit 593d11a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

core/app/models/spree/shipment.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,10 @@ def determine_state(order)
221221
# ready all other cases
222222
def recalculate_state
223223
self.state =
224-
if order.canceled? || inventory_units.all?(&:canceled?)
225-
"canceled"
226-
elsif shipped?
224+
if shipped?
227225
"shipped"
226+
elsif order.canceled? || inventory_units.all?(&:canceled?)
227+
"canceled"
228228
elsif !order.can_ship?
229229
"pending"
230230
elsif can_transition_from_pending_to_ready?

0 commit comments

Comments
 (0)