show warning when a new invoice can be generated

This commit is contained in:
Mohamed ABDELLANI
2023-12-11 10:40:45 +01:00
parent b8e24918fc
commit 1038536c39
3 changed files with 10 additions and 1 deletions

View File

@@ -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' }

View File

@@ -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.

View File

@@ -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)