enter image description here我想将帐户发票中显示的总金额转换为单词,请提供帮助。我无法解决。我也已经尝试过了,但是没有运气
答案 0 :(得分:1)
您要在报告中还是将其记录下来?
报告
在Odoo10中,我通常会这样:
<t t-esc="o.amount_total" t-esc-options='{"widget": "num2words","case":"capital"}'/>
在这里,我们必须安装num2words模块才能正常工作。您可以通过
进行安装 pip install num2words
或只是Google。
答案 1 :(得分:0)
您可以使用以下方法解决问题。
def Numbers_To_Words (number):
dictionary = {'1': "one", '2': "two", '3': "three", '4': "four", '5': "five", '6': "six",
'7': "seven", '8': "eight", '9': "nine", '0': "zero"}
return " ".join(map(lambda x: dictionary[x], str(number)))
print Numbers_To_Words(1234)
答案 2 :(得分:0)
python install pip install num2words
num2words
from num2words import num2words
@api.multi
def numtoword_s(self, amount_total):
return (num2words(amount_total, lang='en_IN')).title()+" only"
在发票文件中创建此函数,然后从qweb调用应用程序,将要转换为文本格式的金额传递给
。答案 3 :(得分:0)
这可能会帮助您:https://www.daniweb.com/programming/software-development/code/216839/number-to-word-converter-python
这也是:https://pypi.org/project/inflect/ 这是一个py lib,可以用相关字词代表您的电话号码