module Invoicexpress::Models::BaseInvoice

Fields common to all invoice models, necessary for create/update

Public Class Methods

included(base) click to toggle source
# File lib/invoicexpress/models/invoice.rb, line 43
def self.included(base)
  base.class_eval do
    include HappyMapper
    element :id, Integer
    element :date, Date, :on_save => DATE_FORMAT
    element :due_date, Date, :on_save => DATE_FORMAT
    element :reference, String
    element :observations, String
    element :retention, Float
    element :tax_exemption, String
    element :sequence_id, Integer
    element :mb_reference, String

    element :rate, String
    element :currency_code, String

    has_one :client, Client
    has_many :items, Item, :on_save => Proc.new { |value|
      Items.new(:items => value)
    }
  end
end