From 5599764071545bb18fdefe1bde1d1f543a85b4c9 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Tue, 16 Dec 2025 13:32:39 +0100 Subject: [PATCH] [18.0][FIX] hr_attendacne_leave_report: In absences, take into account the fields "request_date_from" and "request_date_to". --- hr_attendance_leave_report/models/hr_leave.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/hr_attendance_leave_report/models/hr_leave.py b/hr_attendance_leave_report/models/hr_leave.py index badbc564..77a551cc 100644 --- a/hr_attendance_leave_report/models/hr_leave.py +++ b/hr_attendance_leave_report/models/hr_leave.py @@ -23,10 +23,16 @@ def create(self, vals_list): vals["date_from_without_hour"] = _get_local_date( vals.get("date_from"), self.env.user.tz ) + else: + if "request_date_from" in vals: + vals["date_from_without_hour"] = vals.get("request_date_from") if "date_to" in vals: vals["date_to_without_hour"] = _get_local_date( vals.get("date_to"), self.env.user.tz ) + else: + if "request_date_to" in vals: + vals["date_to_without_hour"] = vals.get("request_date_to") leaves = super().create(vals_list) employees_dates = leaves._catch_employees_check_in_out_dates([]) if employees_dates: @@ -39,15 +45,25 @@ def write(self, vals): vals["date_from_without_hour"] = _get_local_date( vals.get("date_from"), self.env.user.tz ) + else: + if "request_date_from" in vals: + vals["date_from_without_hour"] = vals.get("request_date_from") if "date_to" in vals: vals["date_to_without_hour"] = _get_local_date( vals.get("date_to"), self.env.user.tz ) + else: + if "request_date_to" in vals: + vals["date_to_without_hour"] = vals.get("request_date_to") employees_dates = self._catch_employees_check_in_out_dates([]) result = super().write(vals) if ( "date_from_without_hour" in vals + or "request_date_from" in vals or "date_to_without_hour" in vals + or "request_date_to" in vals + or "request_hour_from" in vals + or "request_hour_to" in vals or "state" in vals ): employees_dates = self._catch_employees_check_in_out_dates(employees_dates)