[IMP] hr_holidays: show the initial duration while the accrual is selected

Purpose of the task is, when the accrual is selected, the field for
duration is hidden but the feature allows to use it.

So in this commit,when accrual is selected, display number of days
(duration) to provide an intial allocation while accrual is selected.
Also change label and tooltip according to allocation type.

closes odoo/odoo#48354

Taskid: 2199324
Closes: #47598
X-original-commit: 74df5cbaf37d3cc6da0b15efa9d7f4a4ec265ec5
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
Helly kapatel
2020-03-25 13:46:11 +00:00
committed by Barad Mahendra
parent ad69cc13d3
commit e4ebd3e6e3
3 changed files with 15 additions and 8 deletions
+8 -4
View File
@@ -1275,6 +1275,12 @@ msgstr ""
msgid "Duration"
msgstr ""
#. module: hr_holidays
#: model_terms:ir.ui.view,arch_db:hr_holidays.hr_leave_allocation_view_form
#: model_terms:ir.ui.view,arch_db:hr_holidays.hr_leave_view_form
msgid "Extra days"
msgstr ""
#. module: hr_holidays
#: model:ir.model.fields,field_description:hr_holidays.field_hr_leave__number_of_days
msgid "Duration (Days)"
@@ -2805,15 +2811,13 @@ msgstr ""
#. module: hr_holidays
#: model:ir.model.fields,help:hr_holidays.field_hr_leave_allocation__number_of_days_display
msgid ""
"UX field allowing to see and modify the allocation duration, computed in "
"days."
"If Accrual Allocation: Number of days allocated in addition to the ones you will get via the accrual' system."
msgstr ""
#. module: hr_holidays
#: model:ir.model.fields,help:hr_holidays.field_hr_leave_allocation__number_of_hours_display
msgid ""
"UX field allowing to see and modify the allocation duration, computed in "
"hours."
"If Accrual Allocation: Number of hours allocated in addition to the ones you will get via the accrual' system."
msgstr ""
#. module: hr_holidays
@@ -77,10 +77,10 @@ class HolidaysAllocation(models.Model):
number_of_days_display = fields.Float(
'Duration (days)', compute='_compute_number_of_days_display',
states={'draft': [('readonly', False)], 'confirm': [('readonly', False)]},
help="UX field allowing to see and modify the allocation duration, computed in days.")
help="If Accrual Allocation: Number of days allocated in addition to the ones you will get via the accrual' system.")
number_of_hours_display = fields.Float(
'Duration (hours)', compute='_compute_number_of_hours_display',
help="UX field allowing to see and modify the allocation duration, computed in hours.")
help="If Accrual Allocation: Number of hours allocated in addition to the ones you will get via the accrual' system.")
duration_display = fields.Char('Allocated (Days/Hours)', compute='_compute_duration_display',
help="Field allowing to see the allocation duration in days or hours depending on the type_request_unit")
# details
@@ -91,8 +91,11 @@
<field name="allocation_type" invisible="1" widget="radio"/>
<field name="number_of_days" invisible="1"/>
<label for="number_of_days" string="Duration" attrs="{'invisible': [('allocation_type', '=', 'accrual')]}"/>
<div attrs="{'invisible': [('allocation_type', '=', 'accrual')]}">
<div class="o_td_label">
<label for="number_of_days" string="Duration" attrs="{'invisible': [('allocation_type', '=', 'accrual')]}"/>
<label for="number_of_days" string="Extra days" attrs="{'invisible': [('allocation_type', '!=', 'accrual')]}"/>
</div>
<div>
<field name="number_of_days_display" class="oe_inline" nolabel="1"
attrs="{'readonly': ['|', ('type_request_unit', '=', 'hour'), ('state', 'not in', ('draft', 'confirm'))], 'invisible': [('type_request_unit', '=', 'hour')]}"/>
<field name="number_of_hours_display" class="oe_inline" nolabel="1"