From b445c80c7d5f1ef732bb8a06f2738d6b039f67a3 Mon Sep 17 00:00:00 2001 From: Julien Mougenot Date: Mon, 5 Jun 2023 14:59:48 +0000 Subject: [PATCH] [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 Signed-off-by: Julien Mougenot (jum) --- addons/hr_holidays/static/src/tours/hr_holidays_tour.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/hr_holidays/static/src/tours/hr_holidays_tour.js b/addons/hr_holidays/static/src/tours/hr_holidays_tour.js index eab6882f461..f981c1c786c 100644 --- a/addons/hr_holidays/static/src/tours/hr_holidays_tour.js +++ b/addons/hr_holidays/static/src/tours/hr_holidays_tour.js @@ -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}`,