From 8c7c72efd3a85fc0547cb258e72b0ed7d1636cb8 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 15 Mar 2013 15:04:22 +0100 Subject: [PATCH] [IMP] badge demo is now in data and added comment field bzr revid: mat@openerp.com-20130315140422-eh0nhi8bbgbkhahb --- addons/gamification/__openerp__.py | 4 +--- addons/gamification/badge.py | 5 +++-- addons/gamification/{badge_demo.xml => badge_data.xml} | 0 addons/gamification/templates/badge_received.mako | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) rename addons/gamification/{badge_demo.xml => badge_data.xml} (100%) diff --git a/addons/gamification/__openerp__.py b/addons/gamification/__openerp__.py index 8ba96c5e564..b8abb625d72 100644 --- a/addons/gamification/__openerp__.py +++ b/addons/gamification/__openerp__.py @@ -52,9 +52,7 @@ A **Badge** is a symbolic token granted to a user as a sign of reward. It can be 'security/gamification_security.xml', 'security/ir.model.access.csv', 'goal_base_data.xml', - ], - 'demo': [ - 'badge_demo.xml', + 'badge_data.xml', ], 'test': [ 'test/goal_demo.yml' diff --git a/addons/gamification/badge.py b/addons/gamification/badge.py index 2240e4486fa..b77d5362f58 100644 --- a/addons/gamification/badge.py +++ b/addons/gamification/badge.py @@ -38,6 +38,7 @@ 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'), + 'comment': fields.text('Comment'), } @@ -349,6 +350,7 @@ class grant_badge_wizard(osv.TransientModel): _columns = { 'user_id': fields.many2one("res.users", string='User', required=True), 'badge_id': fields.many2one("gamification.badge", string='Badge'), + 'comment': fields.text('Comment'), } def action_grant_badge(self, cr, uid, ids, context=None): @@ -365,8 +367,7 @@ class grant_badge_wizard(osv.TransientModel): context=context): badge_user = badge_user_obj.create(cr, uid, - {'user_id': wiz.user_id.id, 'badge_id': wiz.badge_id.id}, context=context) - #badge_obj.write(cr, uid, [badge.id], {'owner_ids': [(1, badge_user.id)]}, context=context) + {'user_id': wiz.user_id.id, 'badge_id': wiz.badge_id.id, 'comment': wiz.comment}, context=context) user_from = self.pool.get('res.users').browse(cr, uid, uid, context=context) diff --git a/addons/gamification/badge_demo.xml b/addons/gamification/badge_data.xml similarity index 100% rename from addons/gamification/badge_demo.xml rename to addons/gamification/badge_data.xml diff --git a/addons/gamification/templates/badge_received.mako b/addons/gamification/templates/badge_received.mako index d5e25860e4e..d1b81502c5b 100644 --- a/addons/gamification/templates/badge_received.mako +++ b/addons/gamification/templates/badge_received.mako @@ -13,8 +13,8 @@ % if badge.image

Badge ${badge.name}

% endif - % if badge.description -

${badge.description}

+ % if badge.comment +

${badge.comment}

% endif \ No newline at end of file