diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-01-09 19:59:27 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-01-09 19:59:27 +0100 |
| commit | d7c5bc02cc2b27442f0d4c8aca70266762be2a32 (patch) | |
| tree | 3a675d15b539a4474be38704405b318bebecdce7 /addons/website_event_track/controllers/main.py | |
| parent | 37b518f1749aff3d6ffb2246c32f2aa1e67d9067 (diff) | |
| parent | 8aa8548d8ab68feb13f3bde51c557db84877e809 (diff) | |
[MERGE] forward port branch saas-12.1 up to 8aa8548d8ab
Diffstat (limited to 'addons/website_event_track/controllers/main.py')
| -rw-r--r-- | addons/website_event_track/controllers/main.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/website_event_track/controllers/main.py b/addons/website_event_track/controllers/main.py index 48447342976..ce7fa9fbf94 100644 --- a/addons/website_event_track/controllers/main.py +++ b/addons/website_event_track/controllers/main.py @@ -64,6 +64,7 @@ class WebsiteEventTrackController(http.Controller): locations[location][-1][3] -= 1 locations[location].append([track, start_date, end_date, 1]) dates[-1][1][location] = locations[location][-1] + locations = collections.OrderedDict(sorted(locations.items(), key=lambda t: t[0].id if t[0] else 0)) return { 'locations': locations, 'dates': dates @@ -77,7 +78,7 @@ class WebsiteEventTrackController(http.Controller): event = event.with_context(tz=event.date_tz or 'UTC') local_tz = pytz.timezone(event.date_tz or 'UTC') days_tracks = collections.defaultdict(lambda: []) - for track in event.track_ids.sorted(lambda track: (track.date or '', bool(track.location_id))): + for track in event.track_ids.sorted(lambda track: (bool(track.date), track.date, bool(track.location_id))): if not track.date: continue date = fields.Datetime.from_string(track.date).replace(tzinfo=pytz.utc).astimezone(local_tz) |
