fix cash flow calc.
authorgniibe <gniibe@fsij.org>
Mon, 11 Jun 2012 11:17:26 +0000 (20:17 +0900)
committergniibe <gniibe@fsij.org>
Mon, 11 Jun 2012 11:17:26 +0000 (20:17 +0900)
accounting/models.py

index 776e229..6167de4 100644 (file)
@@ -121,11 +121,11 @@ class GeneralLedgerEntry(object):
             else:
                 total = -le.amount
             try:
-                le.t.ledgerentry_set.get(account__is_cash=True)
-                if le.account.is_cash:
+                cores_le = le.t.ledgerentry_set.get(account__is_cash=True)
+                if le.account.is_cash or (cores_le.is_credit != le.is_credit):
                     cash_total = 0
                 else:
-                    cash_total = total
+                    cash_total = cores_le.amount
             except:
                 cash_total = 0
             try: