From f28df17cecd4c9717b13e8a39a1ba7879d005303 Mon Sep 17 00:00:00 2001 From: Kris Birov Date: Sun, 7 Jun 2020 22:36:59 +0200 Subject: [PATCH 1/3] Merge pull request #3 from TerraCycle/fix-options-text Fix options text --- app/models/spree/printables/order/invoice_view.rb | 2 +- app/views/spree/admin/bookkeeping_documents/index.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/spree/printables/order/invoice_view.rb b/app/models/spree/printables/order/invoice_view.rb index b28aae58..40a2ec89 100644 --- a/app/models/spree/printables/order/invoice_view.rb +++ b/app/models/spree/printables/order/invoice_view.rb @@ -15,7 +15,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..363f6600 100644 --- a/app/views/spree/admin/bookkeeping_documents/index.html.erb +++ b/app/views/spree/admin/bookkeeping_documents/index.html.erb @@ -114,7 +114,7 @@ <%= 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 %> + <%= 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 %> From d2b26cd38a4876e74396245a191fa1b011370352 Mon Sep 17 00:00:00 2001 From: ekzosta Date: Mon, 5 Jul 2021 11:10:26 +0300 Subject: [PATCH 2/3] Add refunds delegator to invoice_view.rb --- app/models/spree/printables/order/invoice_view.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/spree/printables/order/invoice_view.rb b/app/models/spree/printables/order/invoice_view.rb index 40a2ec89..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 From a911ceae9aa5a0ea14c5072eca63e398a8e5c690 Mon Sep 17 00:00:00 2001 From: TamasKerdo Date: Tue, 17 Aug 2021 16:25:05 +0200 Subject: [PATCH 3/3] [TC-5371] Hide the possibility to download the invoice for the POs --- .../spree/admin/bookkeeping_documents_controller.rb | 1 + .../spree/admin/bookkeeping_documents/index.html.erb | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) 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/views/spree/admin/bookkeeping_documents/index.html.erb b/app/views/spree/admin/bookkeeping_documents/index.html.erb index 363f6600..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, 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 %>