Unrealized Exchange Gain and Loss per sales/purchase invoice

Situation:
. 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).

Doctype:

Document:

Resulting JV:

Example Resulting JV Reversal:

1 Like

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.

Yes, I also need this kind of feature

I have this developed, but not sure if it suites 100% of your needs. Do share what you need to be done.

Would love if you can share it

Hi. @aakvatech hope you doing well. Have a use case that one Customer transaction can happen in multiple currencies. We can define multi debtor account and set each currency. But system is blocking Sales Invoice if the currency is different from Customer base currency. Alternative was to make 2 Customers each having base currencies defined. Then we have to make 2 Customers and keep track of each Customer Master

Any idea if we can have 1 unique Customer but Sales Invoice can be in any currency that is Enabled in system and has currency conversion set?

Basically we want to keep Customer transaction separately to track payments and Sales in each currency per customer. This way we would also be able to keep information of prepaid amount.

We are trying to use Items variation idea. Not sure if it will work. Have Customer template and then make Customer variation based on billing currencies.

Thank you