[IMP] badge demo is now in data and added comment field

bzr revid: mat@openerp.com-20130315140422-eh0nhi8bbgbkhahb
This commit is contained in:
Martin Trigaux 2013-03-15 15:04:22 +01:00
parent db73be36da
commit 8c7c72efd3
4 changed files with 6 additions and 7 deletions

View File

@ -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'

View File

@ -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)

View File

@ -13,8 +13,8 @@
% if badge.image
<p><img src="cid:badge-img.png" alt="Badge ${badge.name}" /></p>
% endif
% if badge.description
<p><em>${badge.description}</em></p>
% if badge.comment
<p><em>${badge.comment}</em></p>
% endif
</body>
</html>