Sha256: 93d62b16ea2742a3a073fd9db5fcae8cd1a7f28a96aee00c54de360a8613e89b

Contents?: true

Size: 886 Bytes

Versions: 9

Compression:

Stored size: 886 Bytes

Contents

module Skr

    # Records a manual entry into the General Leger.
    # Most GL entries are triggered by system events such as an Inventory Receipt, or Invoice payment.
    # A manual entry differs in that it's performed, well *Manually*.
    # It's usually used to balance ledger accounts or as part of closing an accounting period.
    class GlManualEntry < Skr::Model

        has_visible_id

        is_immutable

        has_one :gl_transaction, :as=>:source,
                inverse_of: :source, export: { writable: true }

        validates :gl_transaction, presence: true

        before_create :copy_notes_to_transaction

        def gl_transaction=( transaction )
            super
            copy_notes_to_transaction
        end
        private

        def copy_notes_to_transaction
            self.gl_transaction.description = self.notes[0..100]
        end

    end
end

Version data entries

9 entries across 9 versions & 2 rubygems

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