[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
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import models
|
||||
from . import controllers
|
||||
@@ -0,0 +1,15 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
{
|
||||
'name': 'Forum on course',
|
||||
'category': 'Hidden',
|
||||
'version': '1.0',
|
||||
'summary': 'Allows to link forum on a course',
|
||||
'description': """A Slide channel can be linked to forum. Also, profiles from slide and forum are regrouped together""",
|
||||
'depends': ['website_slides', 'website_forum'],
|
||||
'data': [
|
||||
'views/slide_channel_views.xml'
|
||||
],
|
||||
'auto_install': True,
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import main
|
||||
@@ -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
|
||||
@@ -0,0 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import forum
|
||||
from . import slide_channel
|
||||
@@ -0,0 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class Forum(models.Model):
|
||||
_inherit = 'forum.forum'
|
||||
|
||||
slide_channel_id = fields.Many2one('slide.channel', 'Course')
|
||||
@@ -0,0 +1,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class Channel(models.Model):
|
||||
_inherit = 'slide.channel'
|
||||
|
||||
forum_id = fields.Many2one('forum.forum', 'Course Forum')
|
||||
|
||||
_sql_constraints = [
|
||||
('forum_uniq', 'unique (forum_id)', "Only one forum per slide channel!"),
|
||||
]
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="website_slides_forum_channel_inherit_view_form" model="ir.ui.view">
|
||||
<field name="name">website.slides_forum.view.form.inherit.slide.channel</field>
|
||||
<field name="model">slide.channel</field>
|
||||
<field name="inherit_id" ref="website_slides.view_slide_channel_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//notebook" position="inside">
|
||||
<page string="Forum">
|
||||
<group>
|
||||
<field name="forum_id"/>
|
||||
</group>
|
||||
</page>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user