예제 #1
0
파일: sandbox.py 프로젝트: univic/piecash
# del tr.splits[0]
# b.save()
print(ledger(b))

fdsfds
# create a transaction from a1 to a2
tr = Transaction(currency=c1,
                 description="transfer",
                 splits=[
                     Split(account=a1, value=-100),
                     Split(account=a2, value=100, quantity=30)
                 ])
s.flush()

# ledger_str() returns a representation of the transaction in the ledger-cli format
tr.ledger_str()

# change the book to use the "trading accounts" options
s.book.use_trading_accounts = True
# add a new transaction identical to the previous
tr2 = Transaction(currency=c1,
                  description="transfer 2",
                  splits=[
                      Split(account=a1, value=-100),
                      Split(account=a2, value=100, quantity=30)
                  ])
tr2.ledger_str()
# when flushing, the trading accounts are created
s.flush()
tr2.ledger_str()