mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-30 21:27:17 +00:00
Advance order when creating a shipment
This action gets called from the order edit page when adding line items and it's one of the places that needs to advance the order *before* redirecting back to the order edit action
This commit is contained in:
@@ -21,6 +21,10 @@ module Api
|
||||
@shipment.refresh_rates
|
||||
@shipment.save!
|
||||
|
||||
if @order.line_items.any? && @order.state.in?(["cart", "address", "delivery"])
|
||||
OrderWorkflow.new(@order).advance_to_payment
|
||||
end
|
||||
|
||||
render json: @shipment.reload, serializer: Api::ShipmentSerializer, status: :ok
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user