How to replicate:
Create a vendor
Create a purchase price list in different currency XX than accounting currency YY.
Tie the purchase price list to the vendor.
Create a product and tie it to the purchase pricelist.
Create a currency rate conversion from currency XX to currency YY on date X.
Create a purchase order, buying the created product from the created vendor on date X.
Create a receipt on a particular date with the currency rate set for the date X.
Create a currency rate conversion from currency XX to currency YY on date Y.
Create an invoice on a date Y with the currency rate set for the new date and match it to the receipt.
The match invoice will produce a very faulty accounting.
This problem was reported long ago, BF 3468934, can't find it on sf.net anymore though.
Adding link to commit for version 2.1
Version for previous version attached.
Another problem is that if there's no currency conversion for the given date, zero is used for the conversion when also messes up the accounting.