Sha256: aadf4478d067c06e8a3e0636f30983a4ff955a8bf77f4c6730bf3841d40406bd
Contents?: true
Size: 856 Bytes
Versions: 1
Compression:
Stored size: 856 Bytes
Contents
module Crm class Invoice < ActiveRecord::Base self.table_name = "Invoice" self.primary_key = "InvoiceId" belongs_to :account, foreign_key: 'AccountId', crm_key: 'customerid_account' belongs_to :contact, foreign_key: 'ContactId', crm_key: 'customerid_contact' belongs_to :price_list, foreign_key: 'PriceLevelId', crm_key: 'pricelevelid' belongs_to :currency, foreign_key: 'TransactionCurrencyId', crm_key: 'transactioncurrencyid' has_many :invoice_products, foreign_key: 'InvoiceId' has_many :notes, foreign_key: 'ObjectId' validates :Name, presence: true validates :price_list, presence: true validate :contact_xor_account private def contact_xor_account unless contact.blank? ^ account.blank? errors.add(:base, "Specify a contact or account, not both") end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
activerecord_sqlserver_crm-4.2.14 | app/models/crm/invoice.rb |