def test_balance_using_multi_legged_transaction(self): revenue = self.acm.account_for(ACCOUNT_TYPE.REVENUE) deferred = self.acm.account_for(ACCOUNT_TYPE.RECEIVABLES) receivables = self.acm.account_for(ACCOUNT_TYPE.DEFERRED) multi = Transaction(date(2000, 1, 4)) multi.add(Money(-700), revenue) multi.add(Money(500), receivables) multi.add(Money(200), deferred) multi.post() self.assertReallyEqual(Money(500), receivables.balance()) self.assertReallyEqual(Money(200), deferred.balance()) self.assertReallyEqual(Money(-700), revenue.balance())
def withdraw(self, amount, target, date): # two-legged AT #AccountingTransaction(amount, self, target, date) # multi-legged AT trans = Transaction(date) trans.add(-amount, self) trans.add(amount, target) trans.post()