summaryrefslogtreecommitdiff
path: root/addons/website_slides_forum/controllers/main.py
diff options
context:
space:
mode:
authorDavid Beguin <dbe@odoo.com>2019-01-23 17:00:13 +0000
committerDavid Beguin <dbe@odoo.com>2019-02-14 09:24:10 +0000
commita4a0436ddd51a84e35fa68a13833886ffbb63174 (patch)
treed040fc8617a0be444832b56f87ad82bec04ee8c9 /addons/website_slides_forum/controllers/main.py
parentd8f156ae7333e9e7ce712ee50d4898443c61a610 (diff)
[ADD] website_slides_forum : Allow to create forum on a course
Adds the mega power to make Super Saiyan fusion between website_slides and website_forum A slide.channel can now be linked to a forum to allow users to discuss about their courses. Overrides the slides profile routes to include the potiential linked forum. The profile page will display now all the information of a specific channel with, also, all the information of the linked forum. If no channel is specified, the profile page shows everything (information about all channel and information about all forum). Task ID : 1922159 PR #30988
Diffstat (limited to 'addons/website_slides_forum/controllers/main.py')
-rw-r--r--addons/website_slides_forum/controllers/main.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/addons/website_slides_forum/controllers/main.py b/addons/website_slides_forum/controllers/main.py
new file mode 100644
index 00000000000..e86a4d70bf0
--- /dev/null
+++ b/addons/website_slides_forum/controllers/main.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo.http import request
+from odoo.addons.website_slides.controllers.main import WebsiteSlides
+
+
+class WebsiteSlidesForum(WebsiteSlides):
+ # Profile
+ # ---------------------------------------------------
+ def _prepare_user_profile_parameters(self, **post):
+ post = super(WebsiteSlidesForum, self)._prepare_user_profile_parameters(**post)
+ if post.get('channel_id'):
+ channel = request.env['slide.channel'].browse(int(post.get('channel_id')))
+ if channel.forum_id:
+ post.update({
+ 'forum_id': channel.forum_id.id,
+ 'no_forum': False
+ })
+ else:
+ post.update({'no_forum': True})
+ return post