[GNC] Account Currency Screwed Up Again!

David Cousens davidcousens at bigpond.com
Mon Feb 3 05:45:20 EST 2020


Have you checked the default currency used Edit->Preferences, Accounts tab,
Default Currency. It is normally set to locale. I guess you are in Australia
so it should be AUD. If not, diid you possibly create the book originally
while overseas or the locale on your computer was not set to Australia.
AFAIK it is not possible to edit the currency of an account once it is
created in the Edit Account dialog only in the New Account dialog.

It should be possible to edit the file this but fraught with possible
problems.  Work on a copy of your original file and don't save it over the
original until you are really sure that the problem is fixed and other
problems haven't been created. I would keep a copy of the original even
after you reach this point just to be sure.

Your XML file will have to be uncompressed Edit ->Preferences General Tab
and uncheck the box which says compress files. You may then have to force a
Save. I did this by creating a dummy transaction in a register then hitting
the Save button in the toolbar, deleting the dummy transaction and clicking
Save again.

The section of the XMLfile which contains the commodity information for an
account is reproduced below for a SGD account I have.
<gnc:account version="2.0.0">
  <act:name>TravelMoney_CC_SGD</act:name>
  <act:id type="guid">*7db63ffa514d478191dea006748d7bd6*</act:id>
  <act:type>LIABILITY</act:type>
  <act:commodity>
    <cmdty:space>CURRENCY</cmdty:space>
    *<cmdty:id>SGD</cmdty:id>*
  </act:commodity>

You will have to have the commodity you wish to change the account to
specified earlier in the file in a section like
<gnc:commodity version="2.0.0">
  <cmdty:space>CURRENCY</cmdty:space>
  <cmdty:id>SGD</cmdty:id>
  <cmdty:get_quotes/>
  <cmdty:quote_source>currency</cmdty:quote_source>
  <cmdty:quote_tz/>
</gnc:commodity>

Each transaction to the account will have the commodity specified in a
<trn:currency> tag set. You would need to find all of these and change the
commodity similarly
<gnc:transaction version="2.0.0">
  <trn:id type="guid">4ec8a9416b31469bb1eeaf79c5557092</trn:id>
  <trn:currency>
    <cmdty:space>CURRENCY</cmdty:space>
    <cmdty:id>SGD</cmdty:id>
  </trn:currency>
  <trn:date-posted>
    <ts:date>2019-03-17 10:59:00 +0000</ts:date>
  </trn:date-posted>
  <trn:date-entered>
    <ts:date>2019-05-14 03:25:18 +0000</ts:date>
  </trn:date-entered>
  <trn:description>XX 1897  BP-BOOKSACTUALLY</trn:description>
  <trn:slots>
    <slot>
      <slot:key>date-posted</slot:key>
      <slot:value type="gdate">
        <gdate>2019-03-17</gdate>
      </slot:value>
    </slot>
  </trn:slots>
  <trn:splits>
    <trn:split>
      <split:id type="guid">2bf944df822042849e1cbd5a2b6db3c8</split:id>
      <split:reconciled-state>n</split:reconciled-state>
      <split:value>6100/100</split:value>
      <split:quantity>6654/100</split:quantity>
      <split:account
type="guid">7be97b5f738386fd2272881dc33a0272</split:account>
    </trn:split>
    <trn:split>
      <split:id type="guid">4ef42d767cc748f79ce09d6d8f2d3043</split:id>
      <split:reconciled-state>y</split:reconciled-state>
      <split:reconcile-date>
        <ts:date>2019-05-14 13:59:59 +0000</ts:date>
      </split:reconcile-date>
      <split:value>-6100/100</split:value>
      <split:quantity>-6100/100</split:quantity>
      <split:account
type="guid">*7db63ffa514d478191dea006748d7bd6*</split:account>
    </trn:split>
  </trn:splits>
</gnc:transaction>

Make sure the guid for the account matches up (bolded in the above examples)
in the transaction splits and the account you have modified the currency
for. 

AFAIK they are the only places you should need to modify the currency but I
only have a passing acquaintance with the file XML format and the data
structures so I cannot be sure.

The price database was the other section which had records containing the
currency
  <price>
    <price:id type="guid">5b56177651ba48ffa9ce7410e4f3f355</price:id>
    <price:commodity>
      <cmdty:space>CURRENCY</cmdty:space>
      <cmdty:id>AUD</cmdty:id>
    </price:commodity>
    <price:currency>
      <cmdty:space>CURRENCY</cmdty:space>
      <cmdty:id>SGD</cmdty:id>
    </price:currency>
    <price:time>
      <ts:date>2019-03-21 14:00:00 +0000</ts:date>
    </price:time>
    <price:source>user:price</price:source>
    <price:value>70000/77059</price:value>
  </price>
  <price>

It may be easier edit that with the edit facilities in the Tools->Price
Database if necessary. None of this is really recommended but proceed with
extreme caution lots of backups and good luck.

David Cousens





-----
David Cousens
--
Sent from: http://gnucash.1415818.n4.nabble.com/GnuCash-User-f1415819.html


More information about the gnucash-user mailing list