From 4ced83fa8b86c67e041c7bdeab4f70781d1f73de Mon Sep 17 00:00:00 2001 From: Philippe Wauthy Date: Thu, 16 Jun 2022 13:29:20 +0000 Subject: [PATCH] [FIX] hr_holidays: fix traceback when changing duration of time off When the duration of an approved time off is changed from the time off dashboard, the holiday_status_id field is no longer editable in the form, only the duration of the leave. This causes a traceback due to the custom form controller to update the name of the time off type based on the allocations available. closes odoo/odoo#93858 X-original-commit: b87e672e1e5367d774dee2de6a7c76374cc2da39 Signed-off-by: Yannick Tivisse (yti) Signed-off-by: phwa-odoo --- .../hr_holidays/static/src/js/form/allocation_leave_form.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/hr_holidays/static/src/js/form/allocation_leave_form.js b/addons/hr_holidays/static/src/js/form/allocation_leave_form.js index 6e6db99ef09..c9b588ff637 100644 --- a/addons/hr_holidays/static/src/js/form/allocation_leave_form.js +++ b/addons/hr_holidays/static/src/js/form/allocation_leave_form.js @@ -25,7 +25,9 @@ export const AllocationLeaveFormController = FormController.extend({ context: nameSearchContext, limit: 1 }); - this.$el.find("div[name='holiday_status_id']").find('input')[0].value = nameSearch[0][1]; + if (this.$el.find("div[name='holiday_status_id']").find('input')[0]) { + this.$el.find("div[name='holiday_status_id']").find('input')[0].value = nameSearch[0][1]; + } } return result; }