Files
odoo_source/addons/website_event_track_live/controllers/track_live.py
T
Thibault Delavallée 1163013ed6 [REM] website_event_track_online: merge into website_event_track
PURPOSE

Clean organization and models linked to Event Online feature introduced in
semi stable saas-13.3 at odoo/odoo@981f95bbf4 and odoo/enterprise@14722028ae

Also clean website event menu not being available in website event but only
in website event track, which implies some extra-code to manage it.

In short: merge website_event_online in website_event, website_event_track
_(online/session) in website_event_track.

RATIONALE

_online modules have been added to extend content of website_event and
website_event_track without having any impact on those module. First step
of cleaning is to move this content directly in base module.

track_session module is mainly a rewrite of track module. Second step of
cleaning is to move its content directly in website_event_track.

SPECIFICATIONS

Move remaining content of website event track online to website event track.
Agenda notably is completely replaced by the new one developed within
track_online module.

Update dependencies accordingly.

LINKS

Task ID-2319779
COM odoo/odoo#56067
ENT odoo/enterprise#12520
UPG odoo/upgrade#1654
2020-08-21 17:30:13 +00:00

36 lines
1.3 KiB
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import http
from odoo.addons.website_event_track.controllers.event_track import EventTrackController
class EventTrackLiveController(EventTrackController):
@http.route('/event_track/get_track_suggestion', type='json', auth='public', website=True)
def get_next_track_suggestion(self, track_id):
track = self._fetch_track(track_id)
track_suggestion = track._get_track_suggestions(
restrict_domain=[('youtube_video_url', '!=', False), ('is_published', '=', True)],
limit=1)
if not track_suggestion:
return False
track_suggestion_sudo = track_suggestion.sudo()
track_sudo = track.sudo()
return self._prepare_track_suggestion_values(track_sudo, track_suggestion_sudo)
def _prepare_track_suggestion_values(self, track, track_suggestion):
return {
'current_track': {
'name': track.name,
'website_image_url': track.website_image_url,
},
'suggestion': {
'id': track_suggestion.id,
'name': track_suggestion.name,
'speaker_name': track_suggestion.partner_name,
'website_url': track_suggestion.website_url
}
}