Sha256: 0b2a6152fc57121eba4e5ecf38df6084fb2089ad162a4c8f755f19a41a942565

Contents?: true

Size: 774 Bytes

Versions: 1

Compression:

Stored size: 774 Bytes

Contents

module Skr

    # A location that holds inventory
    class Location < Skr::Model

        has_code_identifier :from=>'name'

        belongs_to :address, export: { writable: true }

        has_many :sku_locs

        validates :gl_branch_code, :presence => true, :numericality=>true, :length=>{:is=>2}

        locked_fields :gl_branch_code

        before_validation :set_defaults, :on=>:create

        # @return [Location] the location that's specified by {Skr::Core::Configuration#default_location_code}
        def self.default
            Location.find_by_code( Core.config.default_location_code )
        end

      private

        def set_defaults
            self.gl_branch_code ||= Skr::Core.config.default_branch_code
            true
        end

    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stockor-core-0.2 lib/skr/location.rb