diff --git a/app/models/invoice.rb b/app/models/invoice.rb index cf12c401dc4..ef8d627a7e6 100644 --- a/app/models/invoice.rb +++ b/app/models/invoice.rb @@ -26,4 +26,8 @@ def serialize_order def cancel_previous_invoices order.invoices.where.not(id:).update_all(cancelled: true) end + + def display_number + "#{order.distributor.id}-#{number}" + end end diff --git a/app/models/invoice/data_presenter.rb b/app/models/invoice/data_presenter.rb index 692c99486bb..c9f0e5de42a 100644 --- a/app/models/invoice/data_presenter.rb +++ b/app/models/invoice/data_presenter.rb @@ -5,8 +5,8 @@ class DataPresenter include ::ActionView::Helpers::NumberHelper attr_reader :invoice - delegate :data, to: :invoice - delegate :number, :date, to: :invoice, prefix: true + delegate :display_number, :data, to: :invoice + delegate :date, to: :invoice, prefix: true FINALIZED_NON_SUCCESSFUL_STATES = %w(canceled returned).freeze diff --git a/app/views/spree/admin/invoices/_invoices_table.html.haml b/app/views/spree/admin/invoices/_invoices_table.html.haml index 4c876319cd9..d1b6c114ebd 100644 --- a/app/views/spree/admin/invoices/_invoices_table.html.haml +++ b/app/views/spree/admin/invoices/_invoices_table.html.haml @@ -14,7 +14,7 @@ %td.align-center.created_at = invoice.presenter.display_date %td.align-center.label - = invoice.number + = invoice.display_number %td.align-center.label = invoice.presenter.total %td.align-center.label diff --git a/app/views/spree/admin/orders/invoice4.html.haml b/app/views/spree/admin/orders/invoice4.html.haml index e65e7c10b99..69c8ec9e8f9 100644 --- a/app/views/spree/admin/orders/invoice4.html.haml +++ b/app/views/spree/admin/orders/invoice4.html.haml @@ -45,7 +45,7 @@ %td{ :align => "left" } %br = "#{t :invoice_number}:" - = @order.invoice_number + = @order.display_number %br = t :invoice_issued_on = l @order.invoice_date