diff --git a/app/views/spree/admin/invoices/index.html.haml b/app/views/spree/admin/invoices/index.html.haml index c97e7bed1b..2bb9c9b429 100644 --- a/app/views/spree/admin/invoices/index.html.haml +++ b/app/views/spree/admin/invoices/index.html.haml @@ -1,3 +1,7 @@ +- if show_generate_invoice_button?(@order) + .alert-box.warning + =t(:order_has_changed_and_invoice_might_not_be_up_to_date) + = render partial: 'spree/admin/shared/order_page_title' = render partial: 'spree/admin/shared/order_tabs', locals: { current: 'Invoices' } diff --git a/config/locales/en.yml b/config/locales/en.yml index 9facc4a793..e55acccfce 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -4182,6 +4182,9 @@ See the %{link} to find out more about %{sitename}'s features and to start using line_item_adjustments: "Line Item Adjustments" order_adjustments: "Order Adjustments" order_total: "Order Total" + invoices: + index: + order_has_changed_and_invoice_might_not_be_up_to_date: "The order has changed since the last invoice update. The invoice shown here might not be up-to-date anymore." overview: enterprises_header: ofn_with_tip: Enterprises are Producers and/or Hubs and are the basic unit of organisation within the Open Food Network. diff --git a/spec/system/admin/order_spec.rb b/spec/system/admin/order_spec.rb index 5776adb41a..b9aec514c3 100644 --- a/spec/system/admin/order_spec.rb +++ b/spec/system/admin/order_spec.rb @@ -1102,12 +1102,14 @@ describe ' expect(page).to have_content "#{customer.first_name} #{customer.last_name} -" expect(page.find("table").text).to have_content(table_header) - # the New invoice button should be visible + # the New invoice button + the warning should be visible expect(page).to have_link "Create or Update Invoice" + expect(page).to have_content "The order has changed since the last invoice update. The invoice shown here might not be up-to-date anymore." click_link "Create or Update Invoice" # and disappear after clicking expect(page).to have_no_link "Create or Update Invoice" + expect(page).to_not have_content "The order has changed since the last invoice update. The invoice shown here might not be up-to-date anymore." # creating an invoice, displays a second row expect(page.find("table").text).to have_content(table_contents)