summaryrefslogtreecommitdiff
path: root/addons/website_slides_forum/controllers
diff options
context:
space:
mode:
authorDavid Beguin <dbe@odoo.com>2019-02-14 10:45:26 +0000
committerDavid Beguin <dbe@odoo.com>2019-02-18 15:15:02 +0000
commit3ab9f1d8abeec6fcbe2fd0aedcf3712c3e3f583b (patch)
tree4bf4d50910b9e0e339861a5eaa0bf48e8097d712 /addons/website_slides_forum/controllers
parent705376a982d64fb41800f148a167ef0fc28ce4c6 (diff)
[IMP] website_slides_forum : set communication on slide.channel at creation - frontend side
Since 556b6454dab07cdf716d404ec0db9aa51a09b165, channel can be linked to a dedicated forum. But the link could only be done in backend, in the slide.channel configuration For now on, website_publishers can create a new dedicated forum when they create a new slide.channel. Link buttons have been added in both forum and slide.channel headers to navigate easily between them. Fix the relation between course and forum in a model point of view. Task ID : 1922159 PR #31109
Diffstat (limited to 'addons/website_slides_forum/controllers')
-rw-r--r--addons/website_slides_forum/controllers/main.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/addons/website_slides_forum/controllers/main.py b/addons/website_slides_forum/controllers/main.py
index e86a4d70bf0..6f898b90fc4 100644
--- a/addons/website_slides_forum/controllers/main.py
+++ b/addons/website_slides_forum/controllers/main.py
@@ -6,8 +6,21 @@ from odoo.addons.website_slides.controllers.main import WebsiteSlides
class WebsiteSlidesForum(WebsiteSlides):
+
+ def _slide_channel_prepare_values(self, **kwargs):
+ communication_type = kwargs.get('communication_type')
+ if communication_type:
+ if communication_type == 'forum':
+ forum = request.env['forum.forum'].create({
+ 'name': kwargs.get('name')
+ })
+ kwargs['forum_id'] = forum.id
+ kwargs['allow_comment'] = communication_type == 'comment'
+ return super(WebsiteSlidesForum, self)._slide_channel_prepare_values(**kwargs)
+
# Profile
# ---------------------------------------------------
+
def _prepare_user_profile_parameters(self, **post):
post = super(WebsiteSlidesForum, self)._prepare_user_profile_parameters(**post)
if post.get('channel_id'):