update the invoice number rendering

This commit is contained in:
Mohamed ABDELLANI
2023-10-21 08:22:12 +01:00
committed by Sigmund Petersen
parent 41d5ca7861
commit fea910f8b6
4 changed files with 8 additions and 4 deletions

View File

@@ -26,4 +26,8 @@ class Invoice < ApplicationRecord
def cancel_previous_invoices
order.invoices.where.not(id:).update_all(cancelled: true)
end
def display_number
"#{order.distributor.id}-#{number}"
end
end

View File

@@ -5,8 +5,8 @@ class Invoice
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

View File

@@ -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

View File

@@ -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