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
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up