From 4c0787b60b024cc9503767b85034dc1748367a68 Mon Sep 17 00:00:00 2001 From: "Touati Djamel (otd)" Date: Tue, 17 Aug 2021 11:32:45 +0000 Subject: [PATCH] [FIX] hr_holidays: Prevent allocation date_to from switching to another day MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Steps to reproduce the bug: Go to your computer's date settings Change region, e.g: (US or choose a region with a negative UTC) Go to the preferences settings in odoo > Change the timezone to US too Go to Time Off app > Manager > Allocations > Create a new one Allocation type : "Accrual Allocation" Set the end date to, e.g: "04/07/2021" save Problem: The end date moves back by one day. The field " date_to " is of ”datetime” type, so we use in the view "widget="date" Therefore, the user can only choose the date. We save the time in the database at" 00: 00:00 ". But as we use in the view "widget="date", after saving the record, the datetime will be converted to a date, based on the user's UTC. For example, in our case: in database, date_to = "2021-07-04 00:00:00" user UTC = "UTC-6" result = "2021-07-04 00:00:00" - 06:00:00 → "2021-07-03 00:18:00" Solution: Remove the widget date to allow a user entering the full date (eg: 2021-07-04 23:00:00), that will be stored correctly in UTC afterwards, instead of having the widget making the date switch to another day. opw-2607082 closes odoo/odoo#75218 X-original-commit: 2ddabf087004e14ac77aa397eb345d750026dd20 Signed-off-by: Yannick Tivisse (yti) Signed-off-by: Djamel Touati --- addons/hr_holidays/views/hr_leave_allocation_views.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/hr_holidays/views/hr_leave_allocation_views.xml b/addons/hr_holidays/views/hr_leave_allocation_views.xml index b2ec4864e36..1ece8001a32 100644 --- a/addons/hr_holidays/views/hr_leave_allocation_views.xml +++ b/addons/hr_holidays/views/hr_leave_allocation_views.xml @@ -166,8 +166,8 @@