Skip to content

Commit

Permalink
[MIG] 14.0 smile_decimal_precision
Browse files Browse the repository at this point in the history
  • Loading branch information
micheledic committed Jul 4, 2024
1 parent 2ac375a commit c8174a7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions smile_decimal_precision/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

{
"name": "Display Decimal Precision",
"version": "15.0.0.0.1",
"depends": ["base"],
"version": "14.0.0.0.1",
"depends": ["web"],
"author": "Smile",
"license": 'AGPL-3',
"description": """
Expand Down
15 changes: 8 additions & 7 deletions smile_decimal_precision/models/res_currency.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ class ResCurrency(models.Model):

@api.depends('rounding', 'display_rounding')
def _get_display_decimal_places(self):
if not self.display_rounding:
self.display_decimal_places = self.decimal_places
elif 0 < self.display_rounding < 1:
self.display_decimal_places = \
int(math.ceil(math.log10(1 / self.display_rounding)))
else:
self.display_decimal_places = 0
for currency in self:
if not currency.display_rounding:
currency.display_decimal_places = currency.decimal_places
elif 0 < currency.display_rounding < 1:
currency.display_decimal_places = \
int(math.ceil(math.log10(1 / currency.display_rounding)))
else:
currency.display_decimal_places = 0

0 comments on commit c8174a7

Please sign in to comment.