3419:22078 -- Bug: Cannot receive payment into a different currency account

  • omfgppc

    GrantLikely wrote: Anyone seen this before?  To reproduce:

    1) Create a new database using the 3.2.1 demo backup file
    2) In System->Master->Exchange Rates notice this exchange rate:
       EUR - 14/01/09 to 17/02/11 - 1.41000
    3) Go Sales->Customer->New
       Create a new customer and change currency to EUR in the Credit tab
    4) Go Accounting->Accounts receivable->Invoices->New
       Select the new customer
       Under line items, add an item (I chose item number 20100) and set the
          quantity to ''1'' and the unit price to 4000 EUR
       Save the invoice
    5) Post the invoice (Accounting->Accounts receivable->Invoices->Post)
    6) Go Accounting->Accounts receivable->Cash Receipts->New
       Select the new customer
       Enter 4000 in the Amount Received field.  Make sure currency is EUR
       Select ''EBANK'' in the post to field (a USD account)
       Make sure distribution date is after 14/01/09
       Select the invoice in the Applications tab and click Apply Line Bal.

    Note at this point that the USD amount under the Amount Received field shows
    $5640.00 (which is correct; 4000 * 1.41000 = 5640.00)

    Note that the amount applied shows 4000 and balance shows 0 (so all of the
    payment is applied).

    Note also that the applied amount in the applications tab shows $4000 USD
    (it should show 4000 EUR), and that the amount pending is shown as 2836.88 EUR
    (which is incorrect, it should be zero).

    7) Save the payment, and click ''yes'' when asked if you''re sure that you want
       to receive an EUR payment in a USD account.
    8) Post the payment
    9) Go Accounting->Reports->G/L Transactions
       Show all transactions on todays data.
       For Invoice transaction:
       - Accounts receivable is debited the correct amount (5640.00)
       - Revenue is credited the correct amount (5640.00)
       For Payment transaction:
       - Correct amount ($5640) is debited to the eBank account
       - Accounts receivable is credited an incorrect amount ($4000)
       - Difference it taken in the deferred revenue account.

    Also related to this bug, if there is no exchange rate set for today''s date,
    then payment to a different currency account will throw an error message.
    This is when both the invoice date and payment date are *not* on today''s date.
    Here is the error message shown:

    ERROR:  No exchange rate for 2 on 2009-03-15
    CONTEXT:  SQL statement \"SELECT SUM(currToCurr(cashrcpt_curr_id,  $1 , cashrcptitem_amount, CURRENT_DATE)) FROM cashrcptitem, cashrcpt WHERE ((cashrcptitem_cashrcpt_id=cashrcpt_id) AND (cashrcptitem_aropen_id= $2 ) )\"
    PL/pgSQL function \"calcpendingarapplications\" line 12 at SQL statement

    Report this to your Systems Administrator.
    ---- -- Read more at http://www.xtuple.org/phpBB2/viewtopic.php?t=3419