Skip to content

Commit

Permalink
Merge branch 'hotfix/v0.10.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
mbulat committed Jan 5, 2015
2 parents 882a59b + 76d4ab3 commit 4171e71
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions app/models/plutus/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ class Account < ActiveRecord::Base
validates_presence_of :type

if Plutus.enable_tenancy
include Tenancy
include Plutus::Tenancy
else
include NoTenancy
include Plutus::NoTenancy
end

# The credit balance for the account.
Expand Down Expand Up @@ -74,10 +74,10 @@ def debits_balance
#
# @return [BigDecimal] The decimal value balance of all accounts
def self.trial_balance
unless self.new.class == Account
unless self.new.class == Plutus::Account
raise(NoMethodError, "undefined method 'trial_balance'")
else
Asset.balance - (Liability.balance + Equity.balance + Revenue.balance - Expense.balance)
Plutus::Asset.balance - (Plutus::Liability.balance + Plutus::Equity.balance + Plutus::Revenue.balance - Plutus::Expense.balance)
end
end

Expand Down
12 changes: 6 additions & 6 deletions app/models/plutus/entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,21 @@ class Entry < ActiveRecord::Base
# entry = Plutus::Entry.build(
# description: "Sold some widgets",
# debits: [
# {account: "Accounts Receivable", amount: 50}],
# {account: "Accounts Receivable", amount: 50}],
# credits: [
# {account: "Sales Revenue", amount: 45},
# {account: "Sales Tax Payable", amount: 5}])
#
# @return [Plutus::Entry] A Entry with built credit and debit objects ready for saving
def self.build(hash)
entry = Entry.new(:description => hash[:description], :commercial_document => hash[:commercial_document])
entry = Plutus::Entry.new(:description => hash[:description], :commercial_document => hash[:commercial_document])
hash[:debits].each do |debit|
a = Account.find_by_name(debit[:account])
entry.debit_amounts << DebitAmount.new(:account => a, :amount => debit[:amount], :entry => entry)
a = Plutus::Account.find_by_name(debit[:account])
entry.debit_amounts << Plutus::DebitAmount.new(:account => a, :amount => debit[:amount], :entry => entry)
end
hash[:credits].each do |credit|
a = Account.find_by_name(credit[:account])
entry.credit_amounts << CreditAmount.new(:account => a, :amount => credit[:amount], :entry => entry)
a = Plutus::Account.find_by_name(credit[:account])
entry.credit_amounts << Plutus::CreditAmount.new(:account => a, :amount => credit[:amount], :entry => entry)
end
entry
end
Expand Down
2 changes: 1 addition & 1 deletion lib/plutus/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Plutus
VERSION = "0.10.0"
VERSION = "0.10.1"
end

0 comments on commit 4171e71

Please sign in to comment.