예제 #1
0
 def test_scu(self, new_book):
     EUR = new_book.commodities[0]
     acc = Account(name="test", type="ASSET", commodity=EUR)
     assert acc.commodity_scu == EUR.fraction
     assert not acc.non_std_scu
     acc.commodity_scu = 100
     assert acc.non_std_scu
     acc.commodity_scu = None
     assert acc.commodity_scu == EUR.fraction
     assert not acc.non_std_scu
예제 #2
0
 def test_scu(self, new_book):
     EUR = new_book.commodities[0]
     acc = Account(name="test", type="ASSET", commodity=EUR)
     assert acc.commodity_scu == EUR.fraction
     assert not acc.non_std_scu
     acc.commodity_scu = 100
     assert acc.non_std_scu
     acc.commodity_scu = None
     assert acc.commodity_scu == EUR.fraction
     assert not acc.non_std_scu
예제 #3
0
파일: sandbox.py 프로젝트: univic/piecash
            print("\t[{}] {} / {} for {}".format(sp.account.commodity, sp.value, sp.quantity, sp.account))
    # sp.memo = "foo"
    # tr.description = "foo"
    # s.session.flush()

    tr = s.transactions.get(description="cross CAD to USD transfer (initiated from USD account)")
    sp = s.transactions.get(description="cross CAD to USD transfer").splits[0]
    # sp.transaction = tr
    tr.description = "foo"
    # tr.currency = s.commodities[-1]
    # print "foooooooooooooooooooooooooooooooo"
    # print sp.transaction, s.transactions.get(description="cross CAD to USD transfer").splits[1].transaction

    acc = s.accounts[0]
    assert isinstance(acc, Account)
    acc.commodity_scu = 1

    s.session.flush()
    Transaction(currency=s.commodities.get(mnemonic="EUR"),
                description="foo",
                splits=[
                    Split(value=Decimal("1.2345"),
                          account=s.accounts[0]),
                    Split(value=Decimal("1.2345"),
                          account=s.accounts[1]),
                ])
    s.session.flush()
    # del tr.splits[-1]
    # print tr.get_imbalances()
fdfsdfds