2021-05-18 22:26:48 +05:00
|
|
|
from odoo import models
|
2021-04-30 16:09:18 +05:00
|
|
|
|
2020-01-17 17:22:56 +05:00
|
|
|
|
2021-04-30 16:09:18 +05:00
|
|
|
class Utils(models.AbstractModel):
|
|
|
|
_name = "client_contracts.utils"
|
2020-01-17 17:22:56 +05:00
|
|
|
|
2021-04-30 16:09:18 +05:00
|
|
|
@staticmethod
|
|
|
|
def to_fixed(number, digit=2):
|
2020-01-29 13:57:03 +05:00
|
|
|
if isinstance(number, str) and number.isdigit():
|
|
|
|
number = float(number)
|
2021-05-18 22:26:48 +05:00
|
|
|
return f"{number:.{digit}f}"
|