【问题标题】:Odoo currency rounding with too many decimals带有太多小数的 Odoo 货币四舍五入
【发布时间】:2021-09-27 09:37:49
【问题描述】:

我正在尝试将一种货币浮点数转换为另一种,但由于某种原因,结果数字(即使它是正确的)有太多小数。

我将欧元浮动 36.75(货币小数四舍五入 = 0.01)转换为捷克克朗浮动(货币小数四舍五入 = 0.01)

例子

eur_currency._convert(36.75, move.company_currency_id, move.company_id, move.date)

结果 = 942.3100000000001

所需输出 = 942.31

【问题讨论】:

标签: python python-3.x odoo rounding odoo-14


【解决方案1】:

你可以使用圆形:

round(result, 2)

【讨论】:

  • 我看不懂评论评论。这对我来说似乎是一个很好的答案,并且正是我在代码中解决这个问题的方法。
猜你喜欢
  • 1970-01-01
  • 2011-09-10
  • 2010-11-13
  • 1970-01-01
  • 1970-01-01
  • 2011-07-05
  • 1970-01-01
  • 2015-03-15
  • 2018-02-14
相关资源
最近更新 更多