changeset 4d69b2cec4b4 in modules/currency:6.0
details: https://hg.tryton.org/modules/currency?cmd=changeset&node=4d69b2cec4b4
description:
        Convert rate values to Decimal

        The version 1.6 of forex-python returns now a string as rate value.

        issue10464
        review348691006
        (grafted from a7ee2b902d34a4f17834b82aacf67768ec65fb6e)
diffstat:

 currency.py |  2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diffs (12 lines):

diff -r 4b76524c91ae -r 4d69b2cec4b4 currency.py
--- a/currency.py       Mon May 03 15:37:31 2021 +0200
+++ b/currency.py       Sat Jun 12 10:06:03 2021 +0200
@@ -433,6 +433,8 @@
             if currency.code not in values:
                 continue
             value = values[currency.code]
+            if not isinstance(value, Decimal):
+                value = Decimal(value)
             rate = get_rate(currency)
             rate.rate = value.quantize(exp, rounding=rounding)
             yield rate

Reply via email to