gnucash maint: Save Changes Bug 776517 - Trial Balance Report:...

John Ralls jralls at code.gnucash.org
Tue Mar 21 20:59:22 EDT 2017


Updated	 via  https://github.com/Gnucash/gnucash/commit/52bb6b52 (commit)
	from  https://github.com/Gnucash/gnucash/commit/f9ca29aa (commit)



commit 52bb6b52fc1245af8ceda80bc7ed916340a6e362
Author: John Ralls <jralls at ceridwen.us>
Date:   Tue Mar 21 17:47:13 2017 -0700

    Save Changes Bug 776517 - Trial Balance Report:...
    
    Total Debits Issue re $0 Commodity Accounts and Price Source Mode Set to
    "Nearest in Time" or "Most Recent"
    
    There was a silent error from gnc-numeric-sub-fixed in
    collect-unrealized-gains because a 0 value wasn't getting its
    denominator set in the gnc-numeric-mul call in
    gnc:exchange-by-pricedb-helper. While this is ultimately a flaw in
    gnc-numeric, this commit works around it by forcing the value to the
    correct denom in gnc:make-commodity-collector.

diff --git a/src/report/report-system/report-utilities.scm b/src/report/report-system/report-utilities.scm
index 7597c82..163b529 100644
--- a/src/report/report-system/report-utilities.scm
+++ b/src/report/report-system/report-utilities.scm
@@ -332,7 +332,10 @@
     ;; If no pair with this commodity exists, we will create one.
     (define (add-commodity-value commodity value)
       ;; lookup the corresponding pair
-      (let ((pair (assoc commodity commoditylist)))
+      (let ((pair (assoc commodity commoditylist))
+            (rvalue (gnc-numeric-convert
+                     value
+                     (gnc-commodity-get-fraction commodity) GNC-RND-ROUND)))
 	(if (not pair)
 	    (begin
 	      ;; create a new pair, using the gnc:numeric-collector
@@ -340,7 +343,7 @@
 	      ;; and add it to the alist
 	      (set! commoditylist (cons pair commoditylist))))
 	;; add the value
-	(gnc:numeric-collector-add (cadr pair) value)))
+	(gnc:numeric-collector-add (cadr pair) rvalue)))
     
     ;; helper function to walk an association list, adding each
     ;; (commodity -> collector) pair to our list at the appropriate 



Summary of changes:
 src/report/report-system/report-utilities.scm | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)



More information about the gnucash-changes mailing list