diff --git a/addons/gamification/badge.py b/addons/gamification/badge.py
index b77d5362f58..ab3bdb81c12 100644
--- a/addons/gamification/badge.py
+++ b/addons/gamification/badge.py
@@ -37,8 +37,12 @@ class gamification_badge_user(osv.Model):
_columns = {
'user_id': fields.many2one('res.users', string="User", required=True),
- 'badge_id': fields.many2one('gamification.badge', string='Badge'),
+ 'badge_id': fields.many2one('gamification.badge', string='Badge', required=True),
'comment': fields.text('Comment'),
+
+ 'badge_name': fields.related('badge_id', 'name', type="char", string="Badge Name"),
+ 'create_date': fields.datetime('Created', readonly=True),
+ 'create_uid': fields.many2one('res.users', 'Creator', readonly=True),
}
@@ -196,14 +200,13 @@ result = pool.get('res.users').search(cr, uid, domain=[], context=context)""",
res = None
for badge_user in self.pool.get('gamification.badge.user').browse(cr, uid, badge_user_ids, context=context):
- values = {'badge': badge}
+ values = {'badge_user': badge_user}
if user_from:
values['user_from'] = user_from
else:
values['user_from'] = False
body_html = template_env.get_template('badge_received.mako').render(values)
- context['badge_user'] = badge_user
res = self.message_post(cr, uid, 0,
body=body_html,
partner_ids=[(4, badge_user.user_id.partner_id.id)],
diff --git a/addons/gamification/badge_view.xml b/addons/gamification/badge_view.xml
index 9ccfbf001e0..2c5d4084bcc 100644
--- a/addons/gamification/badge_view.xml
+++ b/addons/gamification/badge_view.xml
@@ -2,7 +2,7 @@
Congratulation, you have received the badge ${badge.name} ! +
Congratulation, you have received the badge ${badge_user.badge_id.name} ! % if user_from This badge was granted by ${user_from.name}. % endif
- % if badge.image -

${badge.comment}
+ % if badge_user.comment +${badge_user.comment}
% endif