mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-09 03:20:21 +00:00
Remove prefixes from invoice data representation so it conforms to the same interface as order
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
@@ -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'
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user