summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Kersten <jke@odoo.com>2015-01-12 17:23:48 +0100
committerJeremy Kersten <jke@odoo.com>2015-01-12 17:57:19 +0100
commitdf2ddd895192a142aff3b0160764824b2ea6dffd (patch)
tree7fda07c0d25c22ca914ed87c4f8333ebdf943d0b
parent6c4f2ee33cba1f62a26c71b7dda99b53e5b4d7b8 (diff)
[FIX] website_forum: Manual forward port from 30a6be0 and 0de1d89
Code has been refactored since 8.0
-rw-r--r--addons/website_forum/models/forum.py11
-rw-r--r--addons/website_forum/views/website_forum.xml5
2 files changed, 15 insertions, 1 deletions
diff --git a/addons/website_forum/models/forum.py b/addons/website_forum/models/forum.py
index ab2ecabefcd..9ad2bdd49da 100644
--- a/addons/website_forum/models/forum.py
+++ b/addons/website_forum/models/forum.py
@@ -321,6 +321,17 @@ class Post(models.Model):
return post
@api.multi
+ @api.depends('name', 'post_type')
+ def name_get(self):
+ result = []
+ for post in self:
+ if post.post_type == 'discussion' and post.parent_id and not post.name:
+ result.append((post.id, '%s (%s)' % (post.parent_id.name, post.id)))
+ else:
+ result.append((post.id, '%s' % (post.name)))
+ return result
+
+ @api.multi
def write(self, vals):
if 'content' in vals:
vals['content'] = self._update_content(vals['content'], self.forum_id.id)
diff --git a/addons/website_forum/views/website_forum.xml b/addons/website_forum/views/website_forum.xml
index 4aaa8fbfc88..d870a1f2b5e 100644
--- a/addons/website_forum/views/website_forum.xml
+++ b/addons/website_forum/views/website_forum.xml
@@ -727,7 +727,10 @@
t-field="answer.create_uid"
t-field-options='{"widget": "contact", "country_image": true, "fields": ["name", "country_id"]}'
style="display: inline-block;"/>
- <div class="text-muted">On <span t-field="answer.create_date" t-field-options='{"format":"short"}'/></div>
+ <div class="text-muted">
+ <a t-attf-href="/forum/#{slug(question.forum_id)}/question/#{slug(question)}#answer_#{answer.id}">On</a>
+ <span t-field="answer.create_date" t-field-options='{"format":"short"}'/>
+ </div>
</div>
<div class="clearfix"><span t-field="answer.content" class="oe_no_empty"/></div>
<div class="clearfix">