Basic pdf generating

This commit is contained in:
Martin Lensment 2015-04-21 11:16:43 +03:00
parent e987e201ad
commit 727d1226ad
15 changed files with 298 additions and 3 deletions

View file

@ -7,6 +7,9 @@ class Invoice < ActiveRecord::Base
accepts_nested_attributes_for :invoice_items
attr_accessor :billing_email
validates :billing_email, format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i }
validates :invoice_type, :due_date, :currency, :seller_name,
:seller_iban, :buyer_name, :invoice_items, :vat_prc, presence: true
@ -38,6 +41,14 @@ class Invoice < ActiveRecord::Base
Country.new(buyer_country_code)
end
def forward
return false unless valid?
return false unless billing_email
# TODO: forward invoice
true
end
def items
invoice_items
end