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

index d278702..fe8ac1e 100644 (file)
@@ -123,6 +123,8 @@ class GeneralLedgerEntry(object):
             if le.t.ledgerentry_set.filter(account__is_cash=True).count() > 0:
                 if le.account.is_cash:
                     cash_total = 0
+                elif le.account.type.value == 2 and total < 0 and le.t.ledgerentry_set.filter(is_credit=not le.is_credit,account__is_cash=True).count() == 0:
+                    cash_total = 0
                 else:
                     cash_total = total
                     for c_le in le.t.ledgerentry_set.filter(is_credit=not le.is_credit):