Skip to content

Commit

Permalink
Merge pull request #2555 from VzqzAc/splitted-shipment-order-totals
Browse files Browse the repository at this point in the history
Splitted shipment should update order totals/payment status
  • Loading branch information
jhawthorn committed Feb 26, 2018
2 parents 4b735ad + 3fff2e9 commit 20a2c01
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/app/models/spree/fulfilment_changer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ def run!
# are up-to-date, too.
desired_shipment.refresh_rates

# In order to reflect the changes in the order totals
desired_shipment.order.reload
desired_shipment.order.recalculate

true
end

Expand Down
9 changes: 9 additions & 0 deletions core/spec/models/spree/fulfilment_changer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@
subject
end

it 'updates order totals' do
original_total = order.total
original_shipment_total = order.shipment_total

expect { subject }.
to change { order.total }.from(original_total).to(original_total + original_shipment_total).
and change { order.shipment_total }.by(original_shipment_total)
end

context "when transferring to another stock location" do
let(:desired_stock_location) { create(:stock_location) }
let!(:stock_item) do
Expand Down

0 comments on commit 20a2c01

Please sign in to comment.