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
This commit is contained in:
Cédric Krier committed 2023-05-10 10:07:34 +02:00
1 parent 6b70ecf0f3
commit 399b443831
1 file changed
+2 -1
+2 -1
View File
@@ -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