[FIX]pms: property date timezone without user

This commit is contained in:
Darío Lodeiros
2021-10-10 10:42:18 +02:00
parent 25e871272c
commit 61a6f3a42a

View File

@@ -395,12 +395,13 @@ class PmsProperty(models.Model):
def date_property_timezone(self, dt):
self.ensure_one()
tz_property = self.tz
dt = pytz.timezone(tz_property).localize(dt)
dt = dt.replace(tzinfo=None)
dt = pytz.timezone(self.env.user.tz).localize(dt)
dt = dt.astimezone(pytz.utc)
dt = dt.replace(tzinfo=None)
if self.env.user:
tz_property = self.tz
dt = pytz.timezone(tz_property).localize(dt)
dt = dt.replace(tzinfo=None)
dt = pytz.timezone(self.env.user.tz).localize(dt)
dt = dt.astimezone(pytz.utc)
dt = dt.replace(tzinfo=None)
return dt
def _get_payment_methods(self):