diff --git a/app/views/invoices/index.html.haml b/app/views/invoices/index.html.haml index 959be2a88..871eaafd6 100644 --- a/app/views/invoices/index.html.haml +++ b/app/views/invoices/index.html.haml @@ -18,5 +18,5 @@ %br/ -- unless @order.status.closed? +- unless @order.status.closed? || cannot?(:create_invoices, @order) %p= render 'actions_index' diff --git a/test/integration/list_invoices_test.rb b/test/integration/list_invoices_test.rb index b6fd1f951..f99432f25 100644 --- a/test/integration/list_invoices_test.rb +++ b/test/integration/list_invoices_test.rb @@ -18,6 +18,16 @@ class ListInvoicesTest < ActionDispatch::IntegrationTest end end + test 'list invoices as employee which is order responsible for another order has no create/edit/destroy links' do + timeout_safe do + list_invoices_as :lucien + + assert has_no_link?('Erstellen') + assert has_no_link?('Bearbeiten') + assert has_no_link?('Löschen') + end + end + test 'list invoices as order responsible member has create/edit/destroy links' do timeout_safe do list_invoices_as :long_time_john