Hi,
I need to change the amount notation to K, M etc..
For example if the amount is 1000 then it should displayed as 1K..
Thanks
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hi,
I need to change the amount notation to K, M etc..
For example if the amount is 1000 then it should displayed as 1K..
Thanks
Hi,
You can refer the code below.
amount = 2000000
magnitude = 0
while abs(amount) >= 1000:
magnitude += 1
amount /= 1000.0
val = '%s%s' % (amount, ['', 'K', 'M', 'G', 'T', 'P'][magnitude])
print(val)
in the above case the output will be 2.0M.You can change the code according to your field name and values.Also refer the following link
https://stackoverflow.com/questions/579310/formatting-long-numbers-as-strings-in-python
Regards
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng ký
1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.