From 0de1d896482e24dbe69a0e00a7e753d72b5c082a Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Mon, 12 Jan 2015 15:10:44 +0100 Subject: [PATCH] [FIX] website_forum: add name get on forum.post #4364 When comment is created, emails are sent with subject: "Re: False" and footer: "About Forum False". Now, when the post is a comment, we fallback to the name of the parent (the main forum post). --- addons/website_forum/models/forum.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/addons/website_forum/models/forum.py b/addons/website_forum/models/forum.py index dcae413a8e5..95343de4af6 100644 --- a/addons/website_forum/models/forum.py +++ b/addons/website_forum/models/forum.py @@ -346,6 +346,15 @@ class Post(osv.Model): 'child_ids': list(), } + def name_get(self, cr, uid, ids, context=None): + result = [] + for post in self.browse(cr, uid, ids, context=context): + if 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 + def create(self, cr, uid, vals, context=None): if context is None: context = {}