fix cash flow calc again 6
authorgniibe <gniibe@fsij.org>
Mon, 11 Jun 2012 12:04:46 +0000 (21:04 +0900)
committergniibe <gniibe@fsij.org>
Mon, 11 Jun 2012 12:04:46 +0000 (21:04 +0900)
accounting/models.py

index c4e172f..db7c411 100644 (file)
@@ -121,14 +121,11 @@ class GeneralLedgerEntry(object):
             else:
                 total = -le.amount
             try:
-                cores_le = le.t.ledgerentry_set.get(account__is_cash=True)
-                if le.account.is_cash or (le.account.type.value != 3 and le.account.type.value != 4):
+                le.t.ledgerentry_set.get(account__is_cash=True)
+                if le.account.is_cash or (le.account.type.value == 2 and total < 0)
                     cash_total = 0
                 else:
-                    if total > cores_le:
-                        cash_total = cores_le.amount
-                    else:
-                        cash_total = total
+                    cash_total = total
             except:
                 cash_total = 0
             try: