From 944db71f21874d76c22aeb9c247fa4ecf079ca52 Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Tue, 2 Aug 2016 11:18:05 +0200 Subject: [PATCH] [FIX] website_event: fix get_formated_date to avoid traceback Avoid AttributeError: 'WebsiteEventController (extended by WebsiteEventSa' object has no attribute 'env' Self is the controller and not the event. --- addons/website_event/controllers/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/website_event/controllers/main.py b/addons/website_event/controllers/main.py index 3c36524dbb1..8afc69a20ba 100644 --- a/addons/website_event/controllers/main.py +++ b/addons/website_event/controllers/main.py @@ -194,8 +194,8 @@ class WebsiteEventController(http.Controller): def get_formated_date(self, event): start_date = fields.Datetime.from_string(event.date_begin).date() end_date = fields.Datetime.from_string(event.date_end).date() - month = babel.dates.get_month_names('abbreviated', locale=self.env.context.get('lang', 'en_US'))[start_date.month] - return ('%s %s%s') % (month, start_date.strftime("%e"), (end_date != start_date and ("-"+end_date.strftime("%e")) or "")) + month = babel.dates.get_month_names('abbreviated', locale=event.env.context.get('lang', 'en_US'))[start_date.month] + return ('%s %s%s') % (month, start_date.strftime("%e"), (end_date != start_date and ("-" + end_date.strftime("%e")) or "")) @http.route('/event/get_country_event_list', type='http', auth='public', website=True) def get_country_events(self, **post):