From 399b443831408fa71f8f9c92dce0761d837f5a68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 10 May 2023 10:07:34 +0200 Subject: [PATCH] Remove timezone info after converting datetime in UTC The datetime are always in UTC without tzinfo so they can be compared with the data from the database. Closes #12262 --- modules/stock/product.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/stock/product.py b/modules/stock/product.py index d23c0006d1..7d343a0c0e 100644 --- a/modules/stock/product.py +++ b/modules/stock/product.py @@ -235,7 +235,8 @@ class Product(StockMixin, object, metaclass=PoolMeta): context['_datetime'] = ( context['_datetime'] .replace(tzinfo=timezone) - .astimezone(tz.UTC)) + .astimezone(tz.UTC) + .replace(tzinfo=None)) except OverflowError: pass # The date could be before the product creation