From eb691226d54a86c6ddc20eb7d7179c93e27c4d2b Mon Sep 17 00:00:00 2001 From: l0gesh29 Date: Mon, 28 Jul 2025 13:54:02 +0530 Subject: [PATCH] feat: add show_amount_in_company_currency in gl report (cherry picked from commit 468e5e9b2e173ac0df49d7febe8fc0d3968217be) # Conflicts: # erpnext/accounts/report/general_ledger/general_ledger.js --- .../report/general_ledger/general_ledger.js | 5 +++++ .../report/general_ledger/general_ledger.py | 13 +++++++++++++ erpnext/accounts/report/utils.py | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/report/general_ledger/general_ledger.js b/erpnext/accounts/report/general_ledger/general_ledger.js index 188199292f2..38f9eba4f90 100644 --- a/erpnext/accounts/report/general_ledger/general_ledger.js +++ b/erpnext/accounts/report/general_ledger/general_ledger.js @@ -197,6 +197,11 @@ frappe.query_reports["General Ledger"] = { label: __("Show Net Values in Party Account"), fieldtype: "Check", }, + { + fieldname: "show_amount_in_company_currency", + label: __("Show Credit / Debit in Company Currency"), + fieldtype: "Check", + }, { fieldname: "show_remarks", label: __("Show Remarks"), diff --git a/erpnext/accounts/report/general_ledger/general_ledger.py b/erpnext/accounts/report/general_ledger/general_ledger.py index 0ae8a6070a1..275e0b7e41b 100644 --- a/erpnext/accounts/report/general_ledger/general_ledger.py +++ b/erpnext/accounts/report/general_ledger/general_ledger.py @@ -580,6 +580,19 @@ def get_columns(filters): company = filters.get("company") or get_default_company() filters["presentation_currency"] = currency = get_company_currency(company) + company_currency = get_company_currency(filters.get("company") or get_default_company()) + + if ( + filters.get("show_amount_in_company_currency") + and filters["presentation_currency"] != company_currency + ): + frappe.throw( + _("Presentation Currency cannot be {0} , When {1} is enabled.").format( + frappe.bold(filters["presentation_currency"]), + frappe.bold("Show Credit / Debit in Company Currency"), + ) + ) + columns = [ { "label": _("GL Entry"), diff --git a/erpnext/accounts/report/utils.py b/erpnext/accounts/report/utils.py index 2129f553c8c..92c305e6cd8 100644 --- a/erpnext/accounts/report/utils.py +++ b/erpnext/accounts/report/utils.py @@ -118,7 +118,7 @@ def convert_to_presentation_currency(gl_entries, currency_info, filters=None): len(account_currencies) == 1 and account_currency == presentation_currency and not exchange_gain_or_loss - ): + ) and not filters.get("show_amount_in_company_currency"): entry["debit"] = debit_in_account_currency entry["credit"] = credit_in_account_currency else: