[FIX] hr_holidays: Fix display of a wrong warning message

Currently, when we create time off and does not add 'Start Date' or
'End Date', it displays a wrong warning.
Issue is occur because date_from is required field at db level and it's
value computed based on visible field request_date_from which is
non-required field and when you keep that empty it will raisse the
contraint instead of required error.

So in this commit, we make request_date_field field required from view
and also make request_date_to visible based on condition so it should
fill the proper value inside the date_from and date_to.

closes odoo/odoo#63222

Taskid: 2352360
X-original-commit: c54f445ceae72518f787f43213ec78a9a7e1b1eb
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
Nidhi Patel
2020-12-11 11:00:42 +00:00
committed by Barad Mahendra
parent a6fd6d499c
commit f3725a3dde
+5 -2
View File
@@ -245,7 +245,9 @@
From
</span>
<field name="request_date_from" class="oe_inline" nolabel="1"
attrs="{'readonly': [('state', 'not in', ('draft', 'confirm'))]}"/>
attrs="{'readonly': [('state', 'not in', ('draft', 'confirm'))],
'required': ['|', ('date_from', '=', False), ('date_to', '=', False)]
}"/>
<span class="oe_inline"
attrs="{'invisible': ['|', ('request_unit_half', '=', True), ('request_unit_hours', '=', True)]}">
To
@@ -253,7 +255,8 @@
<field name="request_date_to" class="oe_inline"
attrs="{
'readonly': [('state', 'not in', ('draft', 'confirm'))],
'invisible': ['|', ('request_unit_half', '=', True), ('request_unit_hours', '=', True)]
'invisible': ['|', ('request_unit_half', '=', True), ('request_unit_hours', '=', True)],
'required': ['|', ('date_from', '=', False), ('date_to', '=', False)]
}"/>
<field name="request_date_from_period" class="oe_inline"
string="In"