spree-contrib / spree_print_invoice

Create a PDF invoice for Spree orders.
http://guides.spreecommerce.org
BSD 3-Clause "New" or "Revised" License
91 stars 239 forks source link

Spree Print Invoice Blank #93

Open ChrisEstanol opened 9 years ago

ChrisEstanol commented 9 years ago

I am using Spree 3.0.0, Spree Print Invoice gem and I have set it up in my gemfile using the branch: '3-0-stable'.

I have installed it with the command

bundle && exec rails g spree_print_invoice:install

I have a simple config/initializers/print_invoice.rb

Spree::PrintInvoice::Config.set(page_layout: :portrait,page_size: 'A4')
Spree::PrintInvoice::Config.set(print_buttons: 'invoice')
Spree::PrintInvoice::Config.set(store_pdf: true) # Default: tmp/order_prints

I have now in my admin configuration a Print Invoice Settings section as well as a print invoice button with each orders.

Here is the log when creating invoice:

Started GET "/admin/orders/R123456789.pdf?template=invoice" for ::1 at 2015-07-22 17:10:00 -0500
Processing by Spree::Admin::OrdersController#show as PDF
  Parameters: {"template"=>"invoice", "id"=>"R123456789"}
  Spree::Preference Load (0.3ms)  SELECT  "spree_preferences".* FROM "spree_preferences" WHERE "spree_preferences"."key" = $1 LIMIT 1  [["key", "spree/backend_configuration/locale"]]
  Spree::User Load (0.5ms)  SELECT  "spree_users".* FROM "spree_users" WHERE "spree_users"."deleted_at" IS NULL AND "spree_users"."id" = $1  ORDER BY "spree_users"."id" ASC LIMIT 1  [["id", 6]]
   (0.4ms)  SELECT COUNT(*) FROM "spree_roles" INNER JOIN "spree_roles_users" ON "spree_roles"."id" = "spree_roles_users"."role_id" WHERE "spree_roles_users"."user_id" = $1 AND "spree_roles"."name" = $2  [["user_id", 6], ["name", "admin"]]
  Spree::Order Load (0.6ms)  SELECT  "spree_orders".* FROM "spree_orders" WHERE "spree_orders"."number" = $1  ORDER BY "spree_orders"."id" ASC LIMIT 1  [["number", "R123456789"]]
  Spree::Adjustment Load (0.5ms)  SELECT "spree_adjustments".* FROM "spree_adjustments" WHERE "spree_adjustments"."adjustable_type" = 'Spree::Order' AND "spree_adjustments"."adjustable_id" IN (1)  ORDER BY spree_adjustments.created_at ASC
  Rendered text template (0.0ms)
Sent data  (2.7ms)
Completed 200 OK in 18ms (Views: 2.5ms | ActiveRecord: 2.3ms)

The invoices are created into tmp/order_prints but they all are completely blanks. The pdf viewer of my browser is blocked on loading... Anything I need to do in order to make it work?

alexw23 commented 9 years ago

:+1:

mmintel commented 9 years ago

Same here!

mmintel commented 9 years ago

hi there, my issue was solved after changing "next order number" from 0 to 1. maybe that helps you also?