我需要从sub_total和total_amount的sale_orders中隐藏所有的十进制值。
为此,打开了_ -> _>多个货币的货币设置,然后将舍入因子从0.010000设置到0.000000 (从互联网上的某个地方得到了这条线索)。
但是,这会在确认销售中产生一个除以零错误,当total_amount为零时(由于100%的折扣)--特别是在
File "/opt/bahmni-erp/odoo/addons/account/models/account_move.py", line 63, in _compute_matched_percentage
move.matched_percentage = total_reconciled / total_amount该位置的代码块是
if float_is_zero(total_amount, precision_rounding=precision_currency.rounding):
move.matched_percentage = 1.0
else:
move.matched_percentage = total_reconciled / total_amount该float_is_zero正在调用其他函数集,并最终执行else部件和除法错误。
当我将舍入设置为1.000000时,我认为这个问题已经解决了,现在没有这样的错误了。
我找不到很多关于这个领域的行为以及如何在Odoo下使用它的文档。
请您确认一下上面的解决方案是否正常,不会产生更多的副作用吗?
谢谢。
发布于 2022-10-17 07:12:34
为了解决这个问题,
将数字从(12,6)改为(12,10)。
查找文件vim /usr/lib/python2.7/site-packages/openerp/addons/base/res/res_currency.py并搜索下一个字符串:
1-第一次更改:
rate= fields.function(_get_current_rate, string='Current Rate', digits=(12,10), 2-秒更改:
class res_currency_rate(osv.osv):
_name = "res.currency.rate"
_description = "Currency Rate"
rate= fields.float('Rate', digits=(12, 10), help='The rate of the currency to the currency of rate 1'),希望能帮上忙。
https://stackoverflow.com/questions/74026594
复制相似问题