diff --git a/app/views/spree/admin/adjustments/_adjustments_table.html.haml b/app/views/spree/admin/adjustments/_adjustments_table.html.haml index 7b916f5aee..cbc7df005b 100644 --- a/app/views/spree/admin/adjustments/_adjustments_table.html.haml +++ b/app/views/spree/admin/adjustments/_adjustments_table.html.haml @@ -17,6 +17,7 @@ %td.align-center.label= adjustment.label %td.align-center.amount= adjustment.display_amount.to_html %td.align-center.included-tax= adjustment.display_included_tax.to_html - %td.actions - = link_to_edit adjustment, no_text: true - = link_to_delete adjustment, no_text: true + - unless @order.canceled? + %td.actions + = link_to_edit adjustment, no_text: true + = link_to_delete adjustment, no_text: true diff --git a/app/views/spree/admin/adjustments/index.html.haml b/app/views/spree/admin/adjustments/index.html.haml index 4aa8de7967..31d0e9bff9 100644 --- a/app/views/spree/admin/adjustments/index.html.haml +++ b/app/views/spree/admin/adjustments/index.html.haml @@ -6,7 +6,8 @@ = t(:adjustments) - content_for :page_actions do - %li= button_link_to t(:new_adjustment), new_admin_order_adjustment_url(@order), :icon => 'icon-plus' + - unless @order.canceled? + %li= button_link_to t(:new_adjustment), new_admin_order_adjustment_url(@order), :icon => 'icon-plus' = render partial: 'spree/admin/shared/order_links' %li= button_link_to t(:back_to_orders_list), admin_orders_path, :icon => 'icon-arrow-left' diff --git a/spec/features/admin/adjustments_spec.rb b/spec/features/admin/adjustments_spec.rb index 9d74afd410..9e6b192bc3 100644 --- a/spec/features/admin/adjustments_spec.rb +++ b/spec/features/admin/adjustments_spec.rb @@ -87,4 +87,18 @@ feature ' expect(page).to have_selector 'td.amount', text: '110' expect(page).to have_selector 'td.included-tax', text: '10' end + + scenario "viewing adjustments on a canceled order" do + # Given a taxed adjustment + adjustment = create(:adjustment, label: "Extra Adjustment", adjustable: order, + amount: 110, included_tax: 10, order: order) + order.cancel! + + login_as_admin_and_visit spree.edit_admin_order_path(order) + + click_link 'Adjustments' + + expect(page).to_not have_selector('tr a.icon-edit') + expect(page).to_not have_selector('a.icon-plus'), text: I18n.t(:new_adjustment) + end end