[IMP] gamification: messages posted on user when receiving a badge
now have a subtype, to ease their search. bzr revid: tde@openerp.com-20140411175730-hq06b7qezurzymj6
This commit is contained in:
parent
5a94881b32
commit
d0740bedb9
|
@ -23,7 +23,6 @@
|
|||
<field name="active" eval="False" />
|
||||
</record>
|
||||
|
||||
|
||||
<record id="badge_idea" model="gamification.badge">
|
||||
<field name="name">Brilliant</field>
|
||||
<field name="description">With your brilliant ideas, you are an inspiration to others.</field>
|
||||
|
@ -32,6 +31,16 @@
|
|||
<field name="rule_max_number">2</field>
|
||||
<field name="image" type="base64" file="gamification/static/img/badge_idea-image.png"/>
|
||||
</record>
|
||||
|
||||
<!-- subtype for badge allocation -->
|
||||
<record id="mt_badge_granted" model="mail.message.subtype">
|
||||
<field name="name">Badge Granted</field>
|
||||
<field name="res_model">res.users</field>
|
||||
<field name="default" eval="True"/>
|
||||
<field name="hidden" eval="True"/>
|
||||
<field name="description">Badge Granted</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
|
||||
|
||||
|
|
|
@ -63,7 +63,12 @@ class gamification_badge_user(osv.Model):
|
|||
template_id = self.pool['ir.model.data'].get_object(cr, uid, 'gamification', 'email_template_badge_received', context)
|
||||
for badge_user in self.browse(cr, uid, ids, context=context):
|
||||
body_html = temp_obj.render_template(cr, uid, template_id.body_html, 'gamification.badge.user', badge_user.id, context=context)
|
||||
res = user_obj.message_post(cr, uid, badge_user.user_id.id, body=body_html, partner_ids=[badge_user.user_id.partner_id.id], context=context)
|
||||
res = user_obj.message_post(
|
||||
cr, uid, badge_user.user_id.id,
|
||||
body=body_html,
|
||||
subtype='gamification.mt_badge_granted',
|
||||
partner_ids=[badge_user.user_id.partner_id.id],
|
||||
context=context)
|
||||
return res
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
|
|
Loading…
Reference in New Issue