mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-05 22:26:07 +00:00
update the invoice v3 template
This commit is contained in:
@@ -46,6 +46,8 @@
|
||||
%br
|
||||
= "#{t :invoice_number}:"
|
||||
= @order.display_number
|
||||
- if @order.previous_invoice.present?
|
||||
= "#{t :invoice_cancel_and_replace_invoice} #{ @order.previous_invoice.display_number}"
|
||||
%br
|
||||
= t :invoice_issued_on
|
||||
= l @order.invoice_date
|
||||
|
||||
@@ -1991,6 +1991,7 @@ en:
|
||||
invoice_column_price_per_unit_without_taxes: "Price Per unit (Excl. tax)"
|
||||
invoice_column_tax_rate: "Tax rate"
|
||||
invoice_tax_total: "GST Total:"
|
||||
invoice_cancel_and_replace_invoice: "cancels and replaces invoice"
|
||||
tax_invoice: "TAX INVOICE"
|
||||
tax_total: "Total tax (%{rate}):"
|
||||
invoice_shipping_type: "Type:"
|
||||
|
||||
@@ -662,6 +662,39 @@ describe '
|
||||
end
|
||||
end
|
||||
end
|
||||
describe "Rendering previous invoice number" do
|
||||
context "Order doesn't have previous invoices" do
|
||||
it "should display the invoice number" do
|
||||
login_as_admin
|
||||
visit spree.print_admin_order_path(order, params: {})
|
||||
|
||||
convert_pdf_to_page
|
||||
expect(page).to have_content "#{order.distributor_id}-#{order.invoices.first.number}"
|
||||
end
|
||||
end
|
||||
|
||||
context "Order has previous invoices" do
|
||||
before do
|
||||
OrderInvoiceGenerator.new(order).generate_or_update_latest_invoice
|
||||
first_line_item = order.line_items.first
|
||||
order.line_items.first.update(quantity: first_line_item.quantity + 1)
|
||||
end
|
||||
|
||||
it "should display the invoice number along with the latest invoice number" do
|
||||
login_as_admin
|
||||
visit spree.print_admin_order_path(order, params: {})
|
||||
|
||||
expect(order.invoices.count).to eq(2)
|
||||
|
||||
new_invoice_number = "#{order.distributor_id}-#{order.invoices.first.number}"
|
||||
canceled_invoice_number = "#{order.distributor_id}-#{order.invoices.last.number}"
|
||||
|
||||
convert_pdf_to_page
|
||||
expect(page).to have_content "#{new_invoice_number} cancels and replaces invoice #{
|
||||
canceled_invoice_number}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user