This question has been flagged
1 Reply
5531 Views

a custom module has a float field defined as 

dummy_float= fields.Float(string="Dummy Value", compute="_compute_dummyvalue", store=True, default=0, digits=(16, 6))


how can i achieve that this field will be shown with only 2 decimal places (rounded as XXXX.XX) without changing the field definition (16,6)?

i know i can make a separat computed field but maybe another solution is easier.



Avatar
Discard
Best Answer

Hello @Jack,

You make decimal two points by "%.2f" % self.price_value in your "_compute_dummyvalue" method.

i hope It will helpful for you.

Avatar
Discard
Author

i only want to show 2 decimal points in treeview. The default compute function still needs to store the full precision