Sha256: 927234ff09d4b0c1743c86fcc883d50880de54c284201e013653657a206a044b

Contents?: true

Size: 865 Bytes

Versions: 9

Compression:

Stored size: 865 Bytes

Contents

module Skr

    class SkuVendor < Skr::Model

        acts_as_uom

        belongs_to :sku,    inverse_of:  :sku_vendors, export: true
        belongs_to :vendor, inverse_of:  :sku_vendors, export: true
        has_many :sku_locs, primary_key: :sku_id,      export: true

        delegate_and_export :vendor_code, :vendor_name
        delegate_and_export :sku_code, :sku_description

        validates :list_price, :cost, :uom_size, :numericality=>true, :presence=>true
        validates :uom_code, :part_code, :presence=>true
        validates :sku, :uniqueness=>{ scope: :part_code }

        scope :in_location, lambda { | location |
            location_id = location.is_a?(Numeric) ? location : location.id
            includes(:sku_locs).references(:sku_locs).where(['sku_locs.location_id=?',location_id])
        }, :export=>true


    end

end # Skr module

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
stockor-0.5.0 lib/skr/models/sku_vendor.rb
stockor-0.4.0 lib/skr/models/sku_vendor.rb
stockor-0.3.0 lib/skr/models/sku_vendor.rb
stockor-0.2 lib/skr/models/sku_vendor.rb
stockor-0.1.9 lib/skr/models/sku_vendor.rb
stockor-0.1.8 lib/skr/models/sku_vendor.rb
stockor-0.1.7 lib/skr/models/sku_vendor.rb
stockor-0.1.5 lib/skr/models/sku_vendor.rb
stockor-core-0.2 lib/skr/sku_vendor.rb