[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) <yti@odoo.com>
Signed-off-by: phwa-odoo <phwa@odoo.com>
This commit is contained in:
Philippe Wauthy
2022-06-17 07:45:01 +02:00
parent 84e17847fe
commit 4ced83fa8b
@@ -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;
}