Currency account in CVS broken (was: Bug importing 1.6 currency accounts in CVS)

Christian Stimming stimming@tuhh.de
Mon, 11 Nov 2002 00:18:58 +0100


--------------Boundary-00=_MFVDKVJL2Y3PVL5XQ906
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

On Dienstag, August 20 2002, Herbert Thoma pointed out a bug in imported 
currency accounts from a gnucash-1.6 file into gnucash-CVS. Recently I 
encountered the same problem and it turned out to not only affect 1.6-er 
files but additionally the complete multi-currency handling.

I extended Herbert's demonstration file (attached). Please open it and open 
the "DEM-EUR" currency account. You will see two transactions. One of them is 
not balanced (labelled as "Wrong Transaction"). First bug: This transaction 
has been balanced in gnucash-1.6. But there are more obvious bugs to come. 
Now open the multi-split view of the "Wrong Transaction". 

You see the other split ("Correct Split") that books the 511.29 EUR to a EUR 
account. But in the the split of this account ("Wrong Split"), you see that 
the split value 1000.00 is correct and corresponds to the "Correct 
Transaction". But the split amount is WRONG since it deduces 1000.00 shares 
at a price of 1.0 from this account, whereas it was supposed to deduce 511.29 
shares at a (dynamically calculated) price of 1.95584, just as the price in 
the "Correct Transaction". 

Here's the OBVIOUS BUG: Now try to enter the mentioned price (or any other) in 
the "price" field, and answer the following question such that the "share 
amount" should be changed. Bummer. The amount simply doesn't change at all. 
This is a SERIOUS problem of share/multi-currency handling which definitely 
needs to be sorted out until 1.8. Anybody any ideas?

Christian
--------------Boundary-00=_MFVDKVJL2Y3PVL5XQ906
Content-Type: application/DEFANGED-23; charset="iso-8859-1"; name="currency_account_xac.DEFANGED-23"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="currency_account_xac.DEFANGED-23"

<?xml version="1.0"?>
<gnc-v2>
<gnc:count-data cd:type="book">1</gnc:count-data>
<gnc:book version="(null)">
<book:id type="guid">23e965685f0826db3252ebdecc8a6603</book:id>
<gnc:count-data cd:type="account">5</gnc:count-data>
<gnc:count-data cd:type="transaction">3</gnc:count-data>
<gnc:account version="2.0.0">
  <act:name>DEM account</act:name>
  <act:id type="guid">487bfb5e4378c62cced449d713a643d1</act:id>
  <act:type>BANK</act:type>
  <act:commodity>
    <cmdty:space>ISO4217</cmdty:space>
    <cmdty:id>DEM</cmdty:id>
  </act:commodity>
  <act:commodity-scu>100</act:commodity-scu>
  <act:slots>
    <slot>
      <slot:key>placeholder</slot:key>
      <slot:value type="string">false</slot:value>
    </slot>
    <slot>
      <slot:key>notes</slot:key>
      <slot:value type="string"></slot:value>
    </slot>
  </act:slots>
</gnc:account>
<gnc:account version="2.0.0">
  <act:name>EUR account</act:name>
  <act:id type="guid">9e36a2f29284d5463870cd617c99f43c</act:id>
  <act:type>BANK</act:type>
  <act:commodity>
    <cmdty:space>ISO4217</cmdty:space>
    <cmdty:id>EUR</cmdty:id>
  </act:commodity>
  <act:commodity-scu>100</act:commodity-scu>
  <act:slots>
    <slot>
      <slot:key>placeholder</slot:key>
      <slot:value type="string">false</slot:value>
    </slot>
    <slot>
      <slot:key>notes</slot:key>
      <slot:value type="string"></slot:value>
    </slot>
  </act:slots>
</gnc:account>
<gnc:account version="2.0.0">
  <act:name>DEM-EUR</act:name>
  <act:id type="guid">30e2cd57855ab8449b1b6df5be8dcfa2</act:id>
  <act:type>CURRENCY</act:type>
  <act:commodity>
    <cmdty:space>ISO4217</cmdty:space>
    <cmdty:id>EUR</cmdty:id>
  </act:commodity>
  <act:commodity-scu>100</act:commodity-scu>
  <act:slots>
    <slot>
      <slot:key>placeholder</slot:key>
      <slot:value type="string">false</slot:value>
    </slot>
    <slot>
      <slot:key>notes</slot:key>
      <slot:value type="string"></slot:value>
    </slot>
  </act:slots>
</gnc:account>
<gnc:account version="2.0.0">
  <act:name>Anfangsbestand - DEM</act:name>
  <act:id type="guid">7fa5942c4779c643a971fbaba0f113f6</act:id>
  <act:type>EQUITY</act:type>
  <act:commodity>
    <cmdty:space>ISO4217</cmdty:space>
    <cmdty:id>DEM</cmdty:id>
  </act:commodity>
  <act:commodity-scu>100</act:commodity-scu>
</gnc:account>
<gnc:transaction version="2.0.0">
  <trn:id type="guid">ad4ccdc832a318171c6fd5ae3e87ecf8</trn:id>
  <trn:currency>
    <cmdty:space>ISO4217</cmdty:space>
    <cmdty:id>DEM</cmdty:id>
  </trn:currency>
  <trn:date-posted>
    <ts:date>2002-08-20 00:00:00 +0200</ts:date>
  </trn:date-posted>
  <trn:date-entered>
    <ts:date>2002-08-20 21:17:27 +0200</ts:date>
    <ts:ns>721179000</ts:ns>
  </trn:date-entered>
  <trn:description>Anfangsbestand</trn:description>
  <trn:splits>
    <trn:split>
      <split:id type="guid">842eabd0cb88e62b72fe0076c4ea4007</split:id>
      <split:reconciled-state>n</split:reconciled-state>
      <split:value>100000/100</split:value>
      <split:quantity>100000/100</split:quantity>
      <split:account type="guid">487bfb5e4378c62cced449d713a643d1</split:account>
    </trn:split>
    <trn:split>
      <split:id type="guid">9d82750d52f4e9547f26cbb481324bf4</split:id>
      <split:reconciled-state>n</split:reconciled-state>
      <split:value>-100000/100</split:value>
      <split:quantity>-100000/100</split:quantity>
      <split:account type="guid">7fa5942c4779c643a971fbaba0f113f6</split:account>
    </trn:split>
  </trn:splits>
</gnc:transaction>
<gnc:transaction version="2.0.0">
  <trn:id type="guid">ee01731f2dba7d6a747bdcfc9379a97d</trn:id>
  <trn:currency>
    <cmdty:space>ISO4217</cmdty:space>
    <cmdty:id>DEM</cmdty:id>
  </trn:currency>
  <trn:date-posted>
    <ts:date>2002-08-20 00:00:00 +0200</ts:date>
  </trn:date-posted>
  <trn:date-entered>
    <ts:date>2002-08-20 21:19:31 +0200</ts:date>
    <ts:ns>143281000</ts:ns>
  </trn:date-entered>
  <trn:description>Correct Transaction</trn:description>
  <trn:splits>
    <trn:split>
      <split:id type="guid">3267a5be312daab6ea7e0b496fda14cf</split:id>
      <split:memo>Correct Split</split:memo>
      <split:reconciled-state>n</split:reconciled-state>
      <split:value>100000/100</split:value>
      <split:quantity>51129/100</split:quantity>
      <split:account type="guid">30e2cd57855ab8449b1b6df5be8dcfa2</split:account>
    </trn:split>
    <trn:split>
      <split:id type="guid">88453dedfe3899d6b6f7d88116ae81ca</split:id>
      <split:memo>Correct Split</split:memo>
      <split:reconciled-state>n</split:reconciled-state>
      <split:value>-100000/100</split:value>
      <split:quantity>-100000/100</split:quantity>
      <split:account type="guid">487bfb5e4378c62cced449d713a643d1</split:account>
    </trn:split>
  </trn:splits>
</gnc:transaction>
<gnc:transaction version="2.0.0">
  <trn:id type="guid">e97204d4961aca73f5889febc7240f26</trn:id>
  <trn:currency>
    <cmdty:space>ISO4217</cmdty:space>
    <cmdty:id>EUR</cmdty:id>
  </trn:currency>
  <trn:date-posted>
    <ts:date>2002-08-20 00:00:00 +0200</ts:date>
  </trn:date-posted>
  <trn:date-entered>
    <ts:date>2002-08-20 21:19:31 +0200</ts:date>
    <ts:ns>143574000</ts:ns>
  </trn:date-entered>
  <trn:description>Wrong Transaction</trn:description>
  <trn:splits>
    <trn:split>
      <split:id type="guid">33caf12ba05492924204c5708a35532d</split:id>
      <split:memo>Wrong Split</split:memo>
      <split:reconciled-state>n</split:reconciled-state>
      <split:value>-100000/100</split:value>
      <split:quantity>-100000/100</split:quantity>
      <split:account type="guid">30e2cd57855ab8449b1b6df5be8dcfa2</split:account>
    </trn:split>
    <trn:split>
      <split:id type="guid">3dbe06b9f3a522907720f419c1cece10</split:id>
      <split:memo>Correct Split</split:memo>
      <split:reconciled-state>n</split:reconciled-state>
      <split:value>51129/100</split:value>
      <split:quantity>51129/100</split:quantity>
      <split:account type="guid">9e36a2f29284d5463870cd617c99f43c</split:account>
    </trn:split>
  </trn:splits>
</gnc:transaction>
</gnc:book>
</gnc-v2>

<!-- Local variables: -->
<!-- mode: xml        -->
<!-- End:             -->

--------------Boundary-00=_MFVDKVJL2Y3PVL5XQ906
Content-Type: text/sanitizer-log; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="sanitizer.log"

This message has been 'sanitized'.  This means that potentially
dangerous content has been rewritten or removed.  The following
log describes which actions were taken.

Sanitizer (start="1036970232"):
  Part (pos="930"):
    SanitizeFile (filename="unnamed.txt", mimetype="text/plain"):
      Match (rule="2"):
        Enforced policy: accept

  Part (pos="2569"):
    SanitizeFile (filename="currency_account.xac", mimetype="text/xml"):
      Match (rule="default"):
        Enforced policy: defang

      Replaced mime type with: application/DEFANGED-23
      Replaced file name with: currency_account_xac.DEFANGED-23

  Total modifications so far: 1


Anomy 0.0.0 : Sanitizer.pm
$Id: Sanitizer.pm,v 1.54 2002/02/15 16:59:07 bre Exp $

--------------Boundary-00=_MFVDKVJL2Y3PVL5XQ906--