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

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

        issue10464
        review348691006
diffstat:

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

diffs (12 lines):

diff -r 643f5d9aa5b2 -r a7ee2b902d34 currency.py
--- a/currency.py       Mon May 03 15:37:32 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