Remove prefixes from invoice data representation so it conforms to the same interface as order

This commit is contained in:
Matt-Yorkley
2023-05-09 13:29:44 +01:00
committed by Konrad
parent 8dba1618b1
commit a44f24ad43
5 changed files with 13 additions and 13 deletions

View File

@@ -11,8 +11,8 @@ class Invoice
extend Invoice::DataPresenterAttributes
attributes :additional_tax_total, :currency, :included_tax_total, :payment_total,
:shipping_method_id, :state, :total
attributes :number, :note, :special_instructions, prefix: :order
:shipping_method_id, :state, :total, :number, :note, :special_instructions
attributes_with_presenter :bill_address, :customer, :distributor, :ship_address,
:shipping_method, :order_cycle
@@ -26,7 +26,7 @@ class Invoice
:shipping_method_id, :sorted_line_items, :total
# if any of the following attributes is updated, the latest invoice should be updated
invoice_update_attributes :order_note, :order_special_instructions, :state,
invoice_update_attributes :note, :special_instructions, :state,
:all_eligible_adjustments, :payments
def initialize(invoice)

View File

@@ -1,4 +1,4 @@
%p.callout{style: "margin-top: 30px"}
%strong= t :additional_information
%p{style: "margin: 5px"}
= @invoice_presenter.order_note
= @invoice_presenter.note

View File

@@ -11,7 +11,7 @@
%td{ :align => "left" }
%h4
= "#{t('spree.admin.orders.invoice.tax_invoice')}: "
= "#{@invoice_presenter.order_number}"
= "#{@invoice_presenter.number}"
%td{width: "10%" }
 
%td{ :align => "right" }
@@ -63,11 +63,11 @@
= @invoice_presenter.ship_address.full_address
%br
= @invoice_presenter.ship_address.phone
- if @invoice_presenter.order_special_instructions.present?
- if @invoice_presenter.special_instructions.present?
%br
%br
%strong= t :customer_instructions
= @invoice_presenter.order_special_instructions
= @invoice_presenter.special_instructions
= render 'spree/admin/orders/invoice_table3'
@@ -78,5 +78,5 @@
= render 'spree/admin/orders/_invoice/payment'
- if @invoice_presenter.order_note.present?
- if @invoice_presenter.note.present?
= render partial: 'spree/admin/orders/_invoice/order_note'

View File

@@ -51,7 +51,7 @@
= l @invoice_presenter.order_completed_at.to_date
%br
= t :order_number
= @invoice_presenter.order_number
= @invoice_presenter.number
%td{ :align => "right" }
= t :invoice_billing_address
%br
@@ -75,12 +75,12 @@
= render 'spree/admin/orders/invoice_table4'
- if @invoice_presenter.order_special_instructions.present?
- if @invoice_presenter.special_instructions.present?
%p.callout
%strong
= t :customer_instructions
%p
%em= @invoice_presenter.order_special_instructions
%em= @invoice_presenter.special_instructions
%p
 
@@ -90,5 +90,5 @@
= render 'spree/admin/orders/_invoice/payment'
- if @invoice_presenter.order_note.present?
- if @invoice_presenter.note.present?
= render partial: 'spree/admin/orders/_invoice/order_note'

View File

@@ -22,7 +22,7 @@ describe InvoiceDataGenerator do
new_note = "This is an updated note"
order.update!(note: new_note)
expect(new_invoice_presenter.order_note).to eq(new_note)
expect(new_invoice_presenter.note).to eq(new_note)
end
end