Catch Overflow error when converting datetime to company timestamp

Closes #11999
This commit is contained in:
Sergi Almacellas Abellana
2023-02-15 14:26:59 +01:00
parent d6b8e9671b
commit 08fec3a29e
+6 -2
View File
@@ -42,8 +42,12 @@ class Product(metaclass=PoolMeta):
company = Company(company)
if company.timezone:
timezone = tz.ZoneInfo(company.timezone)
datetime = (
datetime.replace(tzinfo=tz.UTC).astimezone(timezone))
try:
datetime = (
datetime.replace(tzinfo=tz.UTC).astimezone(
timezone))
except OverflowError:
pass
cost_price = self.get_cost_price_at(datetime.date(), **pattern)
if cost_price is not None:
return cost_price