fix cash flow calc again 11
authorgniibe <gniibe@fsij.org>
Mon, 11 Jun 2012 13:58:42 +0000 (22:58 +0900)
committergniibe <gniibe@fsij.org>
Mon, 11 Jun 2012 13:58:42 +0000 (22:58 +0900)
ChangeLog
accounting/models.py

index 2c47a2d..e168cf9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-06-11  NIIBE Yutaka  <gniibe@fsij.org>
+
+       * accounting/models.py (GeneralLedgerEntry.__init__): Fix gle calc.
+
 2012-05-21  Niibe Yutaka  <gniibe@fsij.org>
 
        * templates/top_page.html: Update for 2012.
index d5ebc94..1cb60f0 100644 (file)
@@ -124,7 +124,13 @@ class GeneralLedgerEntry(object):
                 if le.account.is_cash or (le.account.type.value == 2 and total < 0):
                     cash_total = 0
                 else:
-                    cash_total = total
+                    coresponding = 0
+                    for c in le.t.ledgerentry_set.filter(account__is_cash=True):
+                        coresponding = coresponding + c.amount
+                    if corespoinding < total:
+                        cash_total = corespoinding
+                    else:
+                        cash_total = total
             else:
                 cash_total = 0
             try: