[FIX] event: with_context

Using `with_context({'use_babel': True})` overrides completely the
environment context. Therefore, the lang is lost and the date is
formatted in the default language.

opw-779753
This commit is contained in:
Nicolas Martinelli
2017-11-16 18:01:29 +01:00
committed by Nicolas Martinelli
parent d279a3e6d5
commit fe674f06c1
+2 -2
View File
@@ -208,7 +208,7 @@ class EventEvent(models.Model):
@api.depends('date_tz', 'date_begin')
def _compute_date_begin_tz(self):
if self.date_begin:
self.date_begin_located = format_tz(self.with_context({'use_babel': True}).env, self.date_begin, tz=self.date_tz)
self.date_begin_located = format_tz(self.with_context(use_babel=True).env, self.date_begin, tz=self.date_tz)
else:
self.date_begin_located = False
@@ -216,7 +216,7 @@ class EventEvent(models.Model):
@api.depends('date_tz', 'date_end')
def _compute_date_end_tz(self):
if self.date_end:
self.date_end_located = format_tz(self.with_context({'use_babel': True}).env, self.date_end, tz=self.date_tz)
self.date_end_located = format_tz(self.with_context(use_babel=True).env, self.date_end, tz=self.date_tz)
else:
self.date_end_located = False