gnucash stable: [balsheet-pnl.scm] don't generate exchange-fn unnecessarily

Christopher Lam clam at code.gnucash.org
Sat Jun 7 10:23:29 EDT 2025


Updated	 via  https://github.com/Gnucash/gnucash/commit/87c8cd89 (commit)
	from  https://github.com/Gnucash/gnucash/commit/c0a38d34 (commit)



commit 87c8cd8916b74151654ab0ed02da714e5a4951b1
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Jun 7 21:48:40 2025 +0800

    [balsheet-pnl.scm] don't generate exchange-fn unnecessarily
    
    - this will omit warning if common-currency (also price-source) are #f
    - this will also avoid the costly gnc:case-exchange-time-fn call

diff --git a/gnucash/report/reports/standard/balsheet-pnl.scm b/gnucash/report/reports/standard/balsheet-pnl.scm
index da80ad300e..04806128c1 100644
--- a/gnucash/report/reports/standard/balsheet-pnl.scm
+++ b/gnucash/report/reports/standard/balsheet-pnl.scm
@@ -737,9 +737,10 @@ also show overall period profit & loss."))
            accounts-cols-data))
 
          ;; generate an exchange-fn
-         (exchange-fn (gnc:case-exchange-time-fn price-source common-currency
-                                                 (gnc:accounts-get-commodities accounts #f)
-                                                 #f #f #f))
+         (exchange-fn (and common-currency
+                           (gnc:case-exchange-time-fn price-source common-currency
+                                                      (gnc:accounts-get-commodities accounts #f)
+                                                      #f #f #f)))
 
          ;; from col-idx, find effective date to retrieve pricedb
          ;; entry or to limit transactions to calculate average-cost



Summary of changes:
 gnucash/report/reports/standard/balsheet-pnl.scm | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)



More information about the gnucash-changes mailing list