Module: Invoicexpress::Models::BasePurchaseOrder

Included in:
CorePurchaseOrder, PurchaseOrder
Defined in:
lib/invoicexpress/models/purchase_order.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/invoicexpress/models/purchase_order.rb', line 9

def self.included(base)
  base.class_eval do
    include HappyMapper

    tag 'purchase_order'
    element :id, Integer
    element :date, Date, :on_save => DATE_FORMAT 
    element :due_date, Date, :on_save => DATE_FORMAT 
    element :loaded_at, Date, :on_save => DATE_FORMAT 
    element :observations, String
    element :delivery_site, String
    has_one :supplier, Supplier
    has_one :client, Client
    has_many :items, Item, :on_save => Proc.new { |value|
      Items.new(:items => value)
    }
  end
end