[FIX] hr_holidays: Fix tour daterange race condition

Before this commit, the `hr_holidays_tour` tour failed randomly because
a many2one was set just before a daterange, without any kind of safety
check to ensure that all values are input sequentially.

When an update occurs on a record in a form view, a daterange will force
its inputs to be set to the record values. This is done to keep track of
onchanges and to ensure that the field is displaying the proper values.

The issue arises when the tour inputs the daterange values JUST BEFORE
the many2one value is actually committed and updates the daterange
field, in which case the tour values are lost before the daterange could
send an update to the record.

This fix adds proper safety checks in that tour to properly await for
the many2one value to be set before setting the daterange values.

closes odoo/odoo#123852

X-original-commit: 4abb28fb29a9bda6727fb3d04d5b0a017b99e123
Signed-off-by: Kevin Baptiste <kba@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
This commit is contained in:
Julien Mougenot
2023-06-07 12:02:03 +02:00
parent 294291511f
commit b445c80c7d
@@ -28,7 +28,7 @@ registry.category("web_tour.tours").add('hr_holidays_tour', {
{
trigger: 'div[name="holiday_status_id"] input',
content: _t("Let's try to create a Sick Time Off, select it in the list"),
run: `text ${leaveType}`,
run: `text ${leaveType.slice(0, leaveType.length - 1)}`,
},
{
trigger: `.ui-autocomplete .ui-menu-item a:contains("${leaveType}")`,
@@ -38,7 +38,7 @@ registry.category("web_tour.tours").add('hr_holidays_tour', {
},
{
trigger: 'input[data-field=request_date_from]',
extra_trigger: ".o_field_widget[name='holiday_status_id'] input:propValue(NotLimitedHR)",
extra_trigger: `.o_field_widget[name='holiday_status_id'] input:propValue("${leaveType}")`,
content: _t("You can select the period you need to take off, from start date to end date"),
position: 'right',
run: `text ${leaveDateFrom}`,