Sha256: 796ee02f4415eec56358bf8d2e9477bb2b153841ccbb67dd2d5ec8e5b633041b
Contents?: true
Size: 1.12 KB
Versions: 8
Compression:
Stored size: 1.12 KB
Contents
module Skr # Vendors is a companies you purchase goods and services from. # They have both a billing and shipping address, # a gl account that payables should be applied against, and a payment term. class Vendor < Skr::Model # Common code shared with {Customer} include BusinessEntity belongs_to :gl_payables_account, class_name: 'Skr::GlAccount', export: true belongs_to :gl_freight_account, class_name: 'Skr::GlAccount', export: true has_many :purchase_orders, inverse_of: :vendor has_many :vouchers, inverse_of: :vendor has_many :vendor_skus, class_name: 'Skr::SkuVendor', inverse_of: :vendor delegate_and_export :gl_payables_account_number validates :gl_payables_account, set: true has_many :sku_vendors private def set_defaults self.terms ||= PaymentTerm.find_by_code(Skr.config.customer_terms_code) self.gl_payables_account ||= GlAccount.default_for( :ap ) self.gl_freight_account ||= GlAccount.default_for( :freight ) end end end # Skr module
Version data entries
8 entries across 8 versions & 1 rubygems