diff --git a/app/controllers/spree/admin/bookkeeping_documents_controller.rb b/app/controllers/spree/admin/bookkeeping_documents_controller.rb index d532823b..1978c9cc 100644 --- a/app/controllers/spree/admin/bookkeeping_documents_controller.rb +++ b/app/controllers/spree/admin/bookkeeping_documents_controller.rb @@ -17,6 +17,7 @@ def index # Massaging the params for the index view like Spree::Admin::Orders#index params[:q] ||= {} @search = Spree::BookkeepingDocument.ransack(params[:q]) + @is_a_purchase_order = @order.try(:po?) @bookkeeping_documents = @search.result @bookkeeping_documents = @bookkeeping_documents.where(printable: @order) if order_focused? @bookkeeping_documents = @bookkeeping_documents.page(params[:page] || 1).per(10) diff --git a/app/views/spree/admin/bookkeeping_documents/index.html.erb b/app/views/spree/admin/bookkeeping_documents/index.html.erb index d3deb3d9..0902f9e6 100644 --- a/app/views/spree/admin/bookkeeping_documents/index.html.erb +++ b/app/views/spree/admin/bookkeeping_documents/index.html.erb @@ -109,9 +109,11 @@ <%= bookkeeping_document.lastname %> <%= bookkeeping_document.email %> <%= bookkeeping_document.display_total.to_html %> - - <%= link_to_with_icon "file", "", admin_bookkeeping_document_path(bookkeeping_document, format: :pdf), title: "show_bookkeeping_document_#{bookkeeping_document.id}", no_text: true, target: '_blank' %> - + <% if !@is_a_purchase_order || bookkeeping_document.template != 'invoice' %> + + <%= link_to_with_icon "file", "", admin_bookkeeping_document_path(bookkeeping_document, format: :pdf), title: "show_bookkeeping_document_#{bookkeeping_document.id}", no_text: true, target: '_blank' %> + + <% end %> <% end %>