[FIX] website_forum: Manual forward port from 30a6be0 and 0de1d89

Code has been refactored since 8.0
This commit is contained in:
Jeremy Kersten
2015-01-12 17:57:19 +01:00
parent 6c4f2ee33c
commit df2ddd8951
2 changed files with 15 additions and 1 deletions
+11
View File
@@ -320,6 +320,17 @@ class Post(models.Model):
self.env.user.sudo().add_karma(post.forum_id.karma_gen_question_new)
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:
+4 -1
View File
@@ -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">