From 7529e4a15d07792eb9742a37654960466a27be22 Mon Sep 17 00:00:00 2001 From: William Braeckman Date: Fri, 24 Sep 2021 12:28:40 +0000 Subject: [PATCH] [FIX] hr_holidays: fix displaying negative allocations When the attendance app is installed and the extra hours option is enabled, it could happend that we have an allocation with negative virtual_remaining_leaves, however it does not make sense to display it to the user. This commit filters out that possibility from showing on the dashboard. This commit also fixes a display mismatch between extra hours and other time off types. TaskId-2655689 closes odoo/odoo#78295 X-original-commit: c943b55237447ad58a994602e58702c952ac019d Signed-off-by: Kevin Baptiste Signed-off-by: William Braeckman (wbr) --- addons/hr_holidays/models/hr_leave_type.py | 2 +- .../hr_holidays_attendance/static/src/xml/time_off_calendar.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/hr_holidays/models/hr_leave_type.py b/addons/hr_holidays/models/hr_leave_type.py index 241c29316ff..3a09375704f 100644 --- a/addons/hr_holidays/models/hr_leave_type.py +++ b/addons/hr_holidays/models/hr_leave_type.py @@ -293,7 +293,7 @@ class HolidaysType(models.Model): @api.model def get_days_all_request(self): - leave_types = sorted(self.search([]).filtered(lambda x: ((x.virtual_remaining_leaves or x.max_leaves))), key=self._model_sorting_key, reverse=True) + leave_types = sorted(self.search([]).filtered(lambda x: ((x.virtual_remaining_leaves > 0 or x.max_leaves))), key=self._model_sorting_key, reverse=True) return [lt._get_days_request() for lt in leave_types] def _get_days_request(self): diff --git a/addons/hr_holidays_attendance/static/src/xml/time_off_calendar.xml b/addons/hr_holidays_attendance/static/src/xml/time_off_calendar.xml index be130cf57a2..09bbb94ac4b 100644 --- a/addons/hr_holidays_attendance/static/src/xml/time_off_calendar.xml +++ b/addons/hr_holidays_attendance/static/src/xml/time_off_calendar.xml @@ -9,7 +9,7 @@
- HOURS AVAILABLE + HOURS AVAILABLE