From 704ad908a1247c322e2e8395f426ef118a217bc1 Mon Sep 17 00:00:00 2001 From: sofiagvaladze Date: Mon, 22 Nov 2021 19:47:20 +0000 Subject: [PATCH] [FIX] hr_holidays: restrict creation of allocations Purpose: It does not make much sense to create allocations of such an Time Off Types that don't require allocation. task - 2658250 closes odoo/odoo#80541 X-original-commit: 69cee9c13b1d5267b74a9f107bae85ea1c42aa38 Related: odoo/enterprise#22589 Signed-off-by: Kevin Baptiste --- addons/hr_holidays/models/hr_leave_allocation.py | 2 +- addons/hr_holidays/views/hr_leave_type_views.xml | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/hr_holidays/models/hr_leave_allocation.py b/addons/hr_holidays/models/hr_leave_allocation.py index e29457c3343..849be27d47f 100644 --- a/addons/hr_holidays/models/hr_leave_allocation.py +++ b/addons/hr_holidays/models/hr_leave_allocation.py @@ -37,7 +37,7 @@ class HolidaysAllocation(models.Model): def _domain_holiday_status_id(self): if self.user_has_groups('hr_holidays.group_hr_holidays_user'): - return [] + return [('requires_allocation', '=', 'yes')] return [('employee_requests', '=', 'yes')] name = fields.Char('Description', compute='_compute_description', inverse='_inverse_description', search='_search_description', compute_sudo=False) diff --git a/addons/hr_holidays/views/hr_leave_type_views.xml b/addons/hr_holidays/views/hr_leave_type_views.xml index e4e3f2de1f5..da8afb1bbbe 100644 --- a/addons/hr_holidays/views/hr_leave_type_views.xml +++ b/addons/hr_holidays/views/hr_leave_type_views.xml @@ -110,10 +110,11 @@ + + - - - + +