ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Unrealized Exchange Gain and Loss per sales/purchase invoice


. Company needs to calculate profit or loss on regular basis.
. Country legislation requirements to calculate P/L is to use current central bank exchange rates.
. Majority of transactions are billed in foreign currency.
. Company needs to publish report to lenders after recalculations of all types of transactions that are open (liability / debt) and consider it in P/L calculation.
. ERPNext has currency per Sales/Purchase Invoice that is used to record the transaction currency. It is not part of GL records.

Current Solution:

  1. New doctype
  2. Calculation logic for identifying the open/due invoices (both sales & purchase) and match it with given current exchange rate to calculate unrealized gain or loss.
  3. GL transactions created everytime the calculation is run.
  4. Old calculated GL transactions are reversed (line by line).



Resulting JV:

Example Resulting JV Reversal:


Getting open/overdue invoices by below button during draft mode:

Per invoice exchange gain and loss stored in the document.


If this is required by others then I will need assistance to make a PR.


Hi. What assistance do you need?


Getting started with writing test cases and formating code.