[IMP] website_forum: rename fields, labels, texts,...

This commit rename every "Question" references by "Post"
to make it appropriate for both forum's type (Question and Discussion)
It renames some other fields/labels to be shorter or with a
capital letter at the start.
Update demo data to add a title to answers

Part of https://github.com/odoo/odoo/pull/46634

task-2201708
This commit is contained in:
Okan SUMER (osu)
2020-05-14 18:27:00 +00:00
committed by Jeremy Kersten
parent 87a1b54717
commit bfb70b6b9c
8 changed files with 55 additions and 53 deletions
+13 -13
View File
@@ -77,55 +77,55 @@
<!-- Reasons for closing Post -->
<record id="reason_1" model="forum.post.reason">
<field name="name">duplicate post</field>
<field name="name">Duplicate post</field>
<field name="reason_type">basic</field>
</record>
<record id="reason_2" model="forum.post.reason">
<field name="name">off-topic or not relevant</field>
<field name="name">Off-topic or not relevant</field>
<field name="reason_type">basic</field>
</record>
<record id="reason_3" model="forum.post.reason">
<field name="name">too subjective and argumentative</field>
<field name="name">Too subjective and argumentative</field>
<field name="reason_type">basic</field>
</record>
<record id="reason_4" model="forum.post.reason">
<field name="name">not a real post</field>
<field name="name">Not a real post</field>
<field name="reason_type">basic</field>
</record>
<record id="reason_6" model="forum.post.reason">
<field name="name">not relevant or out dated</field>
<field name="name">Not relevant or out dated</field>
<field name="reason_type">basic</field>
</record>
<record id="reason_7" model="forum.post.reason">
<field name="name">contains offensive or malicious remarks</field>
<field name="name">Contains offensive or malicious remarks</field>
<field name="reason_type">basic</field>
</record>
<record id="reason_8" model="forum.post.reason">
<field name="name">spam or advertising</field>
<field name="name">Spam or advertising</field>
<field name="reason_type">basic</field>
</record>
<record id="reason_9" model="forum.post.reason">
<field name="name">too localized</field>
<field name="name">Too localized</field>
<field name="reason_type">basic</field>
</record>
<record id="reason_11" model="forum.post.reason">
<field name="name">insulting and offensive language</field>
<field name="name">Insulting and offensive language</field>
<field name="reason_type">offensive</field>
</record>
<record id="reason_12" model="forum.post.reason">
<field name="name">violent language</field>
<field name="name">Violent language</field>
<field name="reason_type">offensive</field>
</record>
<record id="reason_13" model="forum.post.reason">
<field name="name">inappropriate and unacceptable statements</field>
<field name="name">Inappropriate and unacceptable statements</field>
<field name="reason_type">offensive</field>
</record>
<record id="reason_14" model="forum.post.reason">
<field name="name">threatening language</field>
<field name="name">Threatening language</field>
<field name="reason_type">offensive</field>
</record>
<record id="reason_15" model="forum.post.reason">
<field name="name">racist and hate speech</field>
<field name="name">Racist and hate speech</field>
<field name="reason_type">offensive</field>
</record>
+2
View File
@@ -48,6 +48,7 @@ In simple words does Odoo became CMS+ERP platform?</p>]]></field>
<!-- Answer -->
<record id="answer_0" model="forum.post">
<field name="forum_id" ref="website_forum.forum_help"/>
<field name="name">Re: How to configure alerts for employee contract expiration</field>
<field name="content"><![CDATA[<p>Just for posterity so other can see. Here are the steps to set automatic alerts on any contract.. i.e. HR Employee, or Fleet for example. I will use fleet as an example.</p>
<ul>
<li>Step 1. As a user who has access rights to Technical Features, go to Settings --> Automated Actions. Create A new Automated Action. For the Related Document Model choose.. Contract information on a vehicle (you can also type in the actual model name.. fleet.vehicle.log.contract ) . Set the trigger date to ... Contract Expiration Date. The Next Field (Delay After Trigger Date) is a bit ridiculous. Who wants to be reminded of a contract expiration AFTER the fact? The field should say Days Before Date to Fire Action and the number should be converted to a negative. IMHO. Any way... to get a workable solution you must enter in the number in the negative. So for instance like me if you want to be warned 35 days BEFORE the expiration... put in Delay After Trigger Date.. the number -35 But the sake of testing, right now just put in -1 for 1 day before. Save the Action.
@@ -59,6 +60,7 @@ In simple words does Odoo became CMS+ERP platform?</p>]]></field>
</record>
<record id="answer_1" model="forum.post">
<field name="forum_id" ref="website_forum.forum_help"/>
<field name="name">Re: CMS replacement for ERP and eCommerce</field>
<field name="content"><![CDATA[
<p>Odoo v8 provides a web module and an e-commerce module: www.odoo.com/page/website-builder
The CMS editor in Odoo web is nice but I prefer Drupal for customization and there is a Drupal module for Odoo. I think WP is better than Odoo web too.
+14 -14
View File
@@ -30,9 +30,9 @@ class Forum(models.Model):
name = fields.Char('Forum Name', required=True, translate=True)
sequence = fields.Integer('Sequence', default=1)
mode = fields.Selection([
('questions', 'Questions'),
('discussions', 'Discussions')],
string='Forum Mode', required=True, default='questions',
('questions', 'Questions (1 answer)'),
('discussions', 'Discussions (multiple answers)')],
string='Mode', required=True, default='questions',
help='Questions mode: only one answer allowed\n Discussions mode: multiple answers allowed')
privacy = fields.Selection([
('public', 'Public'),
@@ -84,10 +84,10 @@ class Forum(models.Model):
'of the forum content.')
# posts statistics
post_ids = fields.One2many('forum.post', 'forum_id', string='Posts')
total_posts = fields.Integer('Post Count', compute='_compute_forum_statistics')
total_views = fields.Integer('Views Count', compute='_compute_forum_statistics')
total_answers = fields.Integer('Answers Count', compute='_compute_forum_statistics')
total_favorites = fields.Integer('Favorites Count', compute='_compute_forum_statistics')
total_posts = fields.Integer('Posts', compute='_compute_forum_statistics')
total_views = fields.Integer('Views', compute='_compute_forum_statistics')
total_answers = fields.Integer('Answers', compute='_compute_forum_statistics')
total_favorites = fields.Integer('Favorites', compute='_compute_forum_statistics')
count_posts_waiting_validation = fields.Integer(string="Number of posts waiting for validation", compute='_compute_count_posts_waiting_validation')
count_flagged_posts = fields.Integer(string='Number of flagged posts', compute='_compute_count_flagged_posts')
# karma generation
@@ -220,8 +220,8 @@ class Post(models.Model):
content = fields.Html('Content', strip_style=True)
plain_content = fields.Text('Plain Content', compute='_get_plain_content', store=True)
tag_ids = fields.Many2many('forum.tag', 'forum_tag_rel', 'forum_id', 'forum_tag_id', string='Tags')
state = fields.Selection([('active', 'Active'), ('pending', 'Waiting Validation'), ('close', 'Close'), ('offensive', 'Offensive'), ('flagged', 'Flagged')], string='Status', default='active')
views = fields.Integer('Number of Views', default=0)
state = fields.Selection([('active', 'Active'), ('pending', 'Waiting Validation'), ('close', 'Closed'), ('offensive', 'Offensive'), ('flagged', 'Flagged')], string='Status', default='active')
views = fields.Integer('Views', default=0, readonly=True)
active = fields.Boolean('Active', default=True)
website_message_ids = fields.One2many(domain=lambda self: [('model', '=', self._name), ('message_type', 'in', ['email', 'comment'])])
website_id = fields.Many2one(related='forum_id.website_id', readonly=True)
@@ -229,7 +229,7 @@ class Post(models.Model):
# history
create_date = fields.Datetime('Asked on', index=True, readonly=True)
create_uid = fields.Many2one('res.users', string='Created by', index=True, readonly=True)
write_date = fields.Datetime('Update on', index=True, readonly=True)
write_date = fields.Datetime('Updated on', index=True, readonly=True)
bump_date = fields.Datetime('Bumped on', readonly=True,
help="Technical field allowing to bump a question. Writing on this field will trigger "
"a write on write_date and therefore bump the post. Directly writing on write_date "
@@ -245,14 +245,14 @@ class Post(models.Model):
# favorite
favourite_ids = fields.Many2many('res.users', string='Favourite')
user_favourite = fields.Boolean('Is Favourite', compute='_get_user_favourite')
favourite_count = fields.Integer('Favorite Count', compute='_get_favorite_count', store=True)
favourite_count = fields.Integer('Favorite', compute='_get_favorite_count', store=True)
# hierarchy
is_correct = fields.Boolean('Correct', help='Correct answer or answer accepted')
parent_id = fields.Many2one('forum.post', string='Question', ondelete='cascade')
parent_id = fields.Many2one('forum.post', string='Question', ondelete='cascade', readonly=True)
self_reply = fields.Boolean('Reply to own question', compute='_is_self_reply', store=True)
child_ids = fields.One2many('forum.post', 'parent_id', string='Answers')
child_count = fields.Integer('Number of answers', compute='_get_child_count', store=True)
child_count = fields.Integer('Answers', compute='_get_child_count', store=True)
uid_has_answered = fields.Boolean('Has Answered', compute='_get_uid_has_answered')
has_validated_answer = fields.Boolean('Is answered', compute='_get_has_validated_answer', store=True)
@@ -262,7 +262,7 @@ class Post(models.Model):
# closing
closed_reason_id = fields.Many2one('forum.post.reason', string='Reason')
closed_uid = fields.Many2one('res.users', string='Closed by', index=True)
closed_uid = fields.Many2one('res.users', string='Closed by', index=True, readonly=True)
closed_date = fields.Datetime('Closed on', readonly=True)
# karma calculation and access
@@ -11,11 +11,11 @@ odoo.define("website_forum.tour_forum", function (require) {
}, [{
trigger: ".o_forum_ask_btn",
position: "left",
content: _t("Ask the question in this forum by clicking on the button."),
content: _t("Create a new post in this forum by clicking on the button."),
}, {
trigger: "input[name=post_name]",
position: "top",
content: _t("Give your question title."),
content: _t("Give your post title."),
}, {
trigger: ".note-editable p",
extra_trigger: "input[name=post_name]:not(:propValue(\"\"))",
@@ -31,7 +31,7 @@ odoo.define("website_forum.tour_forum", function (require) {
actions.auto("input[id=s2id_autogen2]");
},
}, {
trigger: "button:contains(\"Post Your Question\")",
trigger: "button:contains(\"Post\")",
extra_trigger: "input[id=s2id_autogen2]:not(:propValue(\"Tags\"))",
content: _t("Click to post your question."),
position: "bottom",
@@ -26,7 +26,7 @@ odoo.define('website_forum.tour_forum_question', function (require) {
}, {
content: "Click to post your question.",
extra_trigger: "#wrap:not(:has(input[id=s2id_autogen2]:propValue('')))",
trigger: 'button:contains("Post Your Question")',
trigger: 'button:contains("Post")',
}, {
content: "This page contain new created question.",
trigger: '#wrap:has(".fa-star")',
+3 -3
View File
@@ -225,10 +225,10 @@
<field name="create_uid"/>
<field name="forum_id"/>
<field name="tag_ids" string="Tag"/>
<filter string="Questions" name="questions" domain="[('parent_id', '=', False)]" />
<filter string="Posts" name="posts" domain="[('parent_id', '=', False)]" />
<filter string="Answers" name="answers" domain="[('parent_id', '!=', False)]" />
<filter string="Accepted Answer" name="accepted_answer" domain="[('is_correct' , '!=', False), ('parent_id', '!=', False)]" />
<filter string="Answered Questions" name="answered_questions" domain="[('child_count', '!=', 0), ('parent_id', '=', False)]" />
<filter string="Answered Posts" name="answered_posts" domain="[('child_count', '!=', 0), ('parent_id', '=', False)]" />
<separator/>
<filter string="Archived" name="inactive" domain="[('active','=',False)]"/>
<group expand="0" string="Group By">
@@ -257,7 +257,7 @@
<field name="view_mode">tree,form,graph</field>
<field name="view_id" ref="view_forum_post_list"/>
<field name="search_view_id" ref="view_forum_post_search"/>
<field name="context">{'search_default_questions':1}</field>
<field name="context">{'search_default_posts':1}</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a new forum post
+18 -18
View File
@@ -89,8 +89,8 @@
<li t-if="queue_type == 'flagged'" class="breadcrumb-item">Flagged</li>
<li t-if="queue_type == 'offensive'" class="breadcrumb-item">Offensive</li>
<li t-if="reasons and offensive" class="breadcrumb-item">Offensive Post</li>
<li t-if="reasons and not offensive" class="breadcrumb-item">Close post</li>
<li t-if="new_question" class="breadcrumb-item">Ask a Question</li>
<li t-if="reasons and not offensive" class="breadcrumb-item">Close Post</li>
<li t-if="new_question" class="breadcrumb-item">New Post</li>
<t t-if="is_edit">
<t t-set="target" t-value="post.parent_id if is_answer else post"/>
<li class="breadcrumb-item text-truncate" style="max-width:150px">
@@ -166,7 +166,7 @@
<t t-elif="searches.get('badges')">Badges</t>
<t t-elif="header.get('is_guidelines')">About</t>
<t t-elif="uid and my == 'favourites'">Favourites</t>
<t t-elif="uid and my == 'mine'">My questions</t>
<t t-elif="uid and my == 'mine'">My Posts</t>
<t t-elif="uid and my == 'followed'">Following</t>
<t t-elif="question">Question</t>
<t t-else="">All Topics</t>
@@ -181,7 +181,7 @@
<div class="dropdown-divider"/>
<a t-att-href="'/forum/%s/user/%s?forum_origin=%s' % (slug(forum), uid, request.httprequest.path)"
class="dropdown-item">My profile</a>
<a t-if="my != 'mine'" t-att-href="url_for('') + '?' + keep_query( 'search', 'sorting', 'filters', my='mine')" class="dropdown-item">My Questions</a>
<a t-if="my != 'mine'" t-att-href="url_for('') + '?' + keep_query( 'search', 'sorting', 'filters', my='mine')" class="dropdown-item">My Posts</a>
<a t-if="my != 'favourites'" t-att-href="url_for('') + '?' + keep_query( 'search', 'sorting', 'filters', my='favourites')" class="dropdown-item">My Favourites</a>
<a t-if="my != 'followed'" t-att-href="url_for('') + '?' + keep_query( 'search', 'sorting', 'filters', my='followed')" class="dropdown-item">I'm Following</a>
<a t-if="my != 'tagged'" t-att-href="url_for('') + '?' + keep_query( 'search', 'sorting', 'filters', my='tagged')" class="dropdown-item">Tags I Follow</a>
@@ -370,7 +370,7 @@
<div class="card-body">
<p>The goal of this site is create a relevant knowledge base that would answer questions related to Odoo.</p>
<p>Therefore questions and answers can be edited like wiki pages by experienced users of this site in order to improve the overall quality of the knowledge base content. Such privileges are granted based on user karma level: you will be able to do the same once your karma gets high enough.</p>
<p>If this approach is not for you, please respect the community and use Google+ communities instead.</p>
<p>If this approach is not for you, please respect the community.</p>
<table class="table table-striped mt-4 bg-white">
<tbody>
<tr>
@@ -503,13 +503,13 @@
<t t-set="location" t-value="url_for('/forum/') + slug(forum) + ( ('/tag/' + slug(tag) + '/questions?') if tag else '?' )"/>
<!-- My Questions -->
<!-- My Posts -->
<span t-if="my == 'mine'" class="nav-link rounded-pill mb-2 active font-weight-bold">
<i class="fa fa-question-circle-o fa-fw"/> My Questions
<i class="fa fa-question-circle-o fa-fw"/> My Posts
<a class="text-reset pull-right no-decoration" t-att-href="location + keep_query('search', 'filters', 'sorting')">&#215;</a>
</span>
<a t-else="" class="nav-link rounded-pill mb-2 text-reset" t-att-href="location + keep_query('search', 'filters', 'sorting', my='mine')">
<i class="fa fa-question-circle-o fa-fw"/> My Questions
<i class="fa fa-question-circle-o fa-fw"/> My Posts
</a>
<!-- My Favourites -->
@@ -581,7 +581,7 @@
<img t-if="uid" class="o_forum_avatar rounded-circle mr-1" t-att-src="website.image_url(user, 'image_128', '16x16')" alt="Avatar"/>
<span t-if="my == 'favourites'"> My <b>Favourites</b></span>
<span t-elif="my == 'followed'"> I'm <b>Following</b></span>
<span t-elif="my == 'mine'"> My <b>Questions</b></span>
<span t-elif="my == 'mine'"> My <b>Posts</b></span>
<span t-elif="my == 'tagged'"> <b>Tags</b> I Follow</span>
</div>
<a t-att-href="url_for('') + '?' + keep_query( 'search', 'filters', 'sorting')" class="btn py-1">&#215;</a>
@@ -597,9 +597,9 @@
<div t-if="uid and request.env.user.forum_waiting_posts_count"
title="You already have a pending post"
data-toggle="popover" data-trigger="hover" data-content="Please wait for a moderator to validate your previous post before continuing.">
<a class="disabled btn btn-secondary btn-block mb-3 mb-md-0" t-attf-href="/forum/#{slug(forum)}/ask">Ask a Question</a>
<a class="disabled btn btn-secondary btn-block mb-3 mb-md-0" t-attf-href="/forum/#{slug(forum)}/ask">New Post</a>
</div>
<a t-else="" role="button" type="button" class="btn btn-primary btn-block o_forum_ask_btn mb-3 mb-md-0" t-att-href="uid and '/forum/' + slug(forum) + '/ask' or '/web/login'">Ask a Question</a>
<a t-else="" role="button" type="button" class="btn btn-primary btn-block o_forum_ask_btn mb-3 mb-md-0" t-att-href="uid and '/forum/' + slug(forum) + '/ask' or '/web/login'">New Post</a>
</div>
<t t-set="no_filters" t-value="not filters in ('solved', 'unsolved', 'unanswered')"/>
@@ -689,7 +689,7 @@
</t>
</div>
<!-- No questions or search/filters result -->
<!-- No posts or search/filters result -->
<div t-if="question_count == 0" class="col">
<div t-if="search or tag or (not no_filters)" class="alert alert-info">
<t t-set="_filters_str">
@@ -700,7 +700,7 @@
<t t-set="_my_str">
<t t-if="my == 'favourites'">in your favourites</t>
<t t-if="my == 'followed'">in your followed list</t>
<t t-if="my == 'mine'">in your questions</t>
<t t-if="my == 'mine'">in your posts</t>
</t>
<t t-set="_search_str"><t t-if="search">matching "<em class="font-weight-bold" t-esc="search"/>"</t></t>
<t t-set="_search_and_tag_str"><t t-if="search and tag">&amp;nbsp;and&amp;nbsp;</t></t>
@@ -721,7 +721,7 @@
No favourite questions in this forum (yet).<br/>
<a t-attf-href="/forum/#{slug(forum)}/">Browse All</a>
</div>
<div t-elif="my == 'mine'" class="alert border">You have no questions in this forum (yet).</div>
<div t-elif="my == 'mine'" class="alert border">You have no posts in this forum (yet).</div>
</t>
<div t-elif="filters == 'unanswered'" class="alert alert-info">Amazing! There are no unanswered questions left!</div>
@@ -770,7 +770,7 @@
<label for="content">Title</label>
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
<input type="text" name="post_name" required="required" pattern=".*\S.*" t-attf-value="#{post_name}"
class="form-control form-control-lg" placeholder="A clear, explicit and concise question title" title="Title must not be empty"/>
class="form-control form-control-lg" placeholder="A clear, explicit and concise title" title="Title must not be empty"/>
<input type="hidden" name="karma" t-attf-value="#{user.karma}" id="karma"/>
<div class="form-text small text-muted">
<a data-toggle="collapse" href="#newQuestionExample" role="button" aria-expanded="false" aria-controls="newQuestionExample">
@@ -782,7 +782,7 @@
<i class="fa fa-check"/> How to configure TPS and TVQ's canadian taxes?
</div>
<div class="text-danger">
<i class="fa fa-times"/> Good morning to all! Please, can someone help solve solve my tax computation problem in Canada? Thanks!
<i class="fa fa-times"/> Good morning to all! Please, can someone help solve my tax computation problem in Canada? Thanks!
</div>
</div>
</div>
@@ -830,12 +830,12 @@
<i class="fa fa-question-circle"/>
</a>
<div class="collapse" id="newQuestionExample">
<div class="my-2">Use a clear, explicit and concise question title</div>
<div class="my-2">Use a clear, explicit and concise title</div>
<div class="text-success">
<i class="fa fa-check"/> How to configure TPS and TVQ's canadian taxes?
</div>
<div class="text-danger">
<i class="fa fa-times"/> Good morning to all! Please, can someone help solve solve my tax computation problem in Canada? Thanks!
<i class="fa fa-times"/> Good morning to all! Please, can someone help solve my tax computation problem in Canada? Thanks!
</div>
</div>
</div>
@@ -20,7 +20,7 @@
<template id="slide_fullscreen" inherit_id="website_slides.slide_fullscreen">
<xpath expr="//a[hasclass('o_wslides_fs_review')]" position="after">
<a t-if="slide.channel_id.forum_id" id="fullscreen_forum_button" class="d-flex align-items-center px-3" t-attf-href="/forum/#{slug(slide.channel_id.forum_id)}" target="new">
<i class="fa fa-comments"/><span class="ml-1 d-none d-md-inline-block">Ask a question</span>
<i class="fa fa-comments"/><span class="ml-1 d-none d-md-inline-block">New Post</span>
</a>
</xpath>
</template>