gnucash maint: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Sat Mar 14 17:03:00 EDT 2020


Updated	 via  https://github.com/Gnucash/gnucash/commit/cfa16258 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/10451929 (commit)
	from  https://github.com/Gnucash/gnucash/commit/d188bca0 (commit)



commit cfa16258540855836f6b5cf4eea83f0db18494c9
Merge: d188bca06 104519290
Author: John Ralls <jralls at ceridwen.us>
Date:   Sat Mar 14 13:56:56 2020 -0700

    Merge Ferran Pallarès's CSV price-rounding fix into maint.


commit 104519290d4d379c3bca14e8567c3b12141dc64e
Author: Ferran Pallarès <pallares.ferran at gmail.com>
Date:   Sat Feb 29 18:44:43 2020 +0100

    Fix rounding precision when importing prices from CSV

diff --git a/gnucash/import-export/csv-imp/gnc-imp-props-price.cpp b/gnucash/import-export/csv-imp/gnc-imp-props-price.cpp
index 0ef97d508..916f46b9c 100644
--- a/gnucash/import-export/csv-imp/gnc-imp-props-price.cpp
+++ b/gnucash/import-export/csv-imp/gnc-imp-props-price.cpp
@@ -332,7 +332,9 @@ Result GncImportPrice::create_price (QofBook* book, GNCPriceDB *pdb, bool over)
         gnc_price_set_commodity (price, *m_from_commodity);
         gnc_price_set_currency (price, *m_to_currency);
 
-        auto amount_conv = amount.convert<RoundType::half_up>(CURRENCY_DENOM);
+        int scu = gnc_commodity_get_fraction (*m_to_currency);
+        auto amount_conv = amount.convert<RoundType::half_up>(scu * COMMODITY_DENOM_MULT);
+
         gnc_price_set_value (price, static_cast<gnc_numeric>(amount_conv));
 
         gnc_price_set_time64 (price, date);



Summary of changes:
 gnucash/import-export/csv-imp/gnc-imp-props-price.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)



More information about the gnucash-changes mailing list