Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling Unallocated Amounts and Exchange Discrepancies in Multi-Currency Payment Entries #43844

Closed
melhembitar opened this issue Oct 25, 2024 · 1 comment · Fixed by #43958
Closed
Assignees
Labels

Comments

@melhembitar
Copy link

Information about bug

Process Overview in Bullet Points:
Multi-Currency Setup:

CAD is the base currency, and payments can be made from foreign currency bank accounts.
Payment Preparation:

When creating a payment entry from a foreign currency bank account, the system calculates the amount based on historical exchange rates, sourced from online platforms.

Unallocated Amount:
The calculated amount difference (between the base currency and foreign currency) is placed in the Write-Off section as "Unallocated Amount" in the supplier's currency.
This represents the discrepancy between the actual payment amount and the amount registered by the system.
Adjusting Unallocated Amount:

User Action Required: The user must adjust this "Unallocated Amount" to match the exact amount received by the supplier.
Risk: If the user skips this adjustment, the payment may be saved incorrectly, resulting in a discrepancy on the third-party account.
Exchange Gain/Loss:

Once the unallocated amount is adjusted, the "Set Exchange Gain/Loss" button becomes active.
The user can then specify an FX Gain/Loss account, which ensures the accounting entry reflects the actual currency exchange difference.

Diagram: Multi-Currency Payment Entry Flow.
point 4 if not done it ll cause the problem in question

Start
|
v

  1. Initiate Payment Entry
    • Select Bank with Foreign Currency
      |
      v
  2. System Calculates Amount
    • Uses Historical Exchange Rate
      |
      v
  3. Register Unallocated Amount
    • Difference shown in Write-Off Section
      |
      v
  4. User Adjusts Unallocated Amount
    • Match exact amount received by supplier
    • Avoids discrepancies in supplier account
      |
      v
  5. Set Exchange Gain/Loss
    • Activate "Set Exchange Gain/Loss"
    • Enter FX Gain/Loss Account
      |
      v
      End: Entry Reflects Accurate Foreign Exchange

photo_2024-10-24_17-05-45

Module

accounts

Version

ERPNext: v15.39.2 (HEAD) - Frappe Framework: v15.45.0 (HEAD)

Installation method

None

Relevant log output / Stack trace / Full Error Message.

No response

@ruthra-kumar ruthra-kumar self-assigned this Oct 28, 2024
@sagarvora sagarvora assigned sagarvora and unassigned ruthra-kumar Nov 7, 2024
@sagarvora
Copy link
Collaborator

sagarvora commented Nov 7, 2024

Proposed Solution

The logic to calculate unallocated_amount is incorrect. It needs following corrections:

  • Consider base_paid_amount instead of base_received_amount for calculation when Payment Entry is of type Receive. And vice-versa for Pay.
  • Don't consider the deduction row related to Exchange Gain / Loss when calculating the Total Allocatable Amount. All other deductions like Cash Discount will still be considered.

The following additional changes are proposed to do above properly:

  • Add a checkbox Is Exchange Gain / Loss? in Payment Entry Deduction. The row with this checkbox will be excluded for the purpose of calculating unallocated_amount.
  • (slightly breaking change) Remove the Set Exchange Gain / Loss button. Instead, automatically calculate the Exchange Gain / Loss as the difference between base_paid_amount and base_received_amount and add the row for Exchange Gain / Loss in Payment Deductions or Loss table automatically in the client side and while saving. This row will also be auto-updated whenever exchange gain/loss changes and during save. Removal of this row will not be permitted, but changing account and cost center will be possible.

Another approach that is possible is to not add exchange gain / loss in the Deductions table and create separate fields for that. But that will be more breaking.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants