[moneydance] moving a transaction to an account with different currency

Jill Lundquist jill at chezns.org
Fri Dec 29 20:23:46 EST 2006


I'm doing something wrong here and would greatly appreciate some clues on how to do it right, since I have hundreds of transactions I need to adjust.  I'm using release 554, though I saw the same behaviour in the previous release as well.

The problem is that after moving from the US to the UK this year, I was still using a 'Train' expense account whose default currency was USD.  I am currently separating these transactions into 'Train USD' and 'Train GBP' categories.  

Here is a commented transcript of one approach I've tried in the jython interface:
# Grab the accounts and show that they indeed have the currencies 
# I think they do.
>>> rootaccount = moneydance.getRootAccount()
>>> usd_acct = matchAccount(rootaccount, 'OldTransportation:Train USD')
>>> usd_acct.getCurrencyType()
US Dollar
>>> gbp_acct = matchAccount(rootaccount, 'OldTransportation:Train GBP')
>>> gbp_acct.getCurrencyType()
British Pound

# Drill down to find an example transaction.
>>> txns = rootAccount.getTransactionSet().getTransactionsForAccount(usd_acct)
>>> txnEnum = txns.getAllTxns()
>>> badTxn = txnEnum[0]

# I bought a train ticket with cash for GBP 15.70, but it's being stored with
# a rate (of currency exchange) and a val of USD 22.94.
>>> badTxn
[SplitTxn(2385) desc=train; val=2294; stat= ; acct=OldTransportation:Train USD; rate=1.4611464968152865; amt=-1570; val=2294;  ]

# I would like at this point to do:
#     badTxn.setRate(1.0)
#     badTxn.setAccount(gbp_acct)
# but what I get after the first is:
>>> badTxn.setRate(1.0)
>>> badTxn
[SplitTxn(2385) desc=train; val=2294; stat= ; acct=OldTransportation:Train USD; rate=1.4611464968152865; amt=-1570; val=2294; dirty;  ]
>>> badTxn.getParentTxn()
[ParentTxn(2386) desc=train; val=-1570; stat= ; #splits=1; chk=; acct=Wallet:GBP Cash; date=20061120; splits=[SplitTxn(2385) desc=train; val=2294; stat= ; acct=OldTransportation:Train USD; rate=1.4611464968152865; amt=-1570; val=2294; dirty;  ], ; ]
>>>

Is there a way for me to undirty this transaction, and will that cause Moneydance to reset the rate and recalculate the val?  

Or perhaps I am approaching this from the wrong angle entirely?  The only way I've been able to get what I want is to choose 'Tools/Edit Categories', double-click 'Train USD', ctrl-click a transaction and select 'Show Other Side', then change the category from 'Train USD' to 'Train GBP', which apparently forces a recalculation.  This procedure is of course fine for a few transactions but I would much rather do hundreds of them via jython if feasible.

Many thanks,

     Jill Lundquist



More information about the moneydance-info mailing list