diff --git a/addons/hr_holidays/models/hr_leave_accrual_plan_level.py b/addons/hr_holidays/models/hr_leave_accrual_plan_level.py index bba3f10ad42..f31bcc0b1fa 100644 --- a/addons/hr_holidays/models/hr_leave_accrual_plan_level.py +++ b/addons/hr_holidays/models/hr_leave_accrual_plan_level.py @@ -42,7 +42,7 @@ class AccrualPlanLevel(models.Model): # Accrue of added_value = fields.Float( - "Rate", required=True, + "Rate", digits=(16, 5), required=True, help="The number of hours/days that will be incremented in the specified Time Off Type for every period") added_value_type = fields.Selection( [('days', 'Days'), diff --git a/addons/hr_holidays/static/src/js/float_without_trailing_zeros.js b/addons/hr_holidays/static/src/js/float_without_trailing_zeros.js new file mode 100644 index 00000000000..a2228d60bcd --- /dev/null +++ b/addons/hr_holidays/static/src/js/float_without_trailing_zeros.js @@ -0,0 +1,17 @@ +/** @odoo-module **/ +import FieldRegistry from 'web.field_registry'; +import basic_fields from 'web.basic_fields'; + +var FieldFloat = basic_fields.FieldFloat; + +var FloatWithoutTrailingZeros = FieldFloat.extend({ + _renderReadonly: function () { + var value = this._formatValue(this.value); + var parsed_value = parseFloat(value); + value = parsed_value.toString().replace(/\.0+$/, ''); + this.$el.text(value); + } +}); + +FieldRegistry.add('float_without_trailing_zeros', FloatWithoutTrailingZeros); + diff --git a/addons/hr_holidays/views/hr_leave_accrual_views.xml b/addons/hr_holidays/views/hr_leave_accrual_views.xml index 6dede3372fa..a690ec84bc4 100644 --- a/addons/hr_holidays/views/hr_leave_accrual_views.xml +++ b/addons/hr_holidays/views/hr_leave_accrual_views.xml @@ -157,7 +157,7 @@
- Adds + Adds (based on worked time)
@@ -179,7 +179,7 @@
- Limit of + Limit of
At the end of the year, unused accruals will be postponedlost