diff --git a/app/controllers/spree/admin/bookkeeping_documents_controller.rb b/app/controllers/spree/admin/bookkeeping_documents_controller.rb index fd074f83..c5135615 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/models/spree/printables/order/invoice_view.rb b/app/models/spree/printables/order/invoice_view.rb index b28aae58..949eb7d3 100644 --- a/app/models/spree/printables/order/invoice_view.rb +++ b/app/models/spree/printables/order/invoice_view.rb @@ -8,6 +8,7 @@ class Printables::Order::InvoiceView < Printables::Invoice::BaseView :item_total, :total, :payments, + :refunds, :shipments def items @@ -15,7 +16,7 @@ def items Spree::Printables::Invoice::Item.new( sku: item.variant.sku, name: item.variant.name, - options_text: item.variant.options_text, + options_text: item.variant.front_end_options_text, price: item.price, quantity: item.quantity, total: item.total diff --git a/app/views/spree/admin/bookkeeping_documents/index.html.erb b/app/views/spree/admin/bookkeeping_documents/index.html.erb index 7d3ee4be..3726ab3c 100644 --- a/app/views/spree/admin/bookkeeping_documents/index.html.erb +++ b/app/views/spree/admin/bookkeeping_documents/index.html.erb @@ -113,9 +113,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 %> - + <% 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 %>