[FIX] gamification: send badge on user, fix function field
bzr revid: mat@openerp.com-20131218140333-nipcc21z5snhac1c
This commit is contained in:
parent
938a07a361
commit
90dfa5895d
|
@ -106,7 +106,7 @@ class gamification_badge(osv.Model):
|
|||
badge_user_obj = self.pool.get('gamification.badge.user')
|
||||
first_month_day = date.today().replace(day=1).strftime(DF)
|
||||
for bid in ids:
|
||||
result[id] = {
|
||||
result[bid] = {
|
||||
'stat_my': badge_user_obj.search(cr, uid, [('badge_id', '=', bid), ('user_id', '=', uid)], context=context, count=True),
|
||||
'stat_this_month': badge_user_obj.search(cr, uid, [('badge_id', '=', bid), ('create_date', '>=', first_month_day)], context=context, count=True),
|
||||
'stat_my_this_month': badge_user_obj.search(cr, uid, [('badge_id', '=', bid), ('user_id', '=', uid), ('create_date', '>=', first_month_day)], context=context, count=True),
|
||||
|
|
|
@ -120,7 +120,6 @@ class hr_employee(osv.osv):
|
|||
|
||||
_columns = {
|
||||
'goal_ids': fields.function(_get_employee_goals, type="one2many", obj='gamification.goal', string="Employee HR Goals"),
|
||||
'badge_ids': fields.function(_get_employee_badges, type="one2many",
|
||||
obj='gamification.badge.user', string="Employee Badges"),
|
||||
'badge_ids': fields.function(_get_employee_badges, type="one2many", obj='gamification.badge.user', string="Employee Badges"),
|
||||
'has_badges': fields.function(_has_badges, type="boolean", string="Has Badges"),
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ class hr_grant_badge_wizard(osv.TransientModel):
|
|||
if context is None:
|
||||
context = {}
|
||||
|
||||
badge_obj = self.pool.get('gamification.badge')
|
||||
badge_user_obj = self.pool.get('gamification.badge.user')
|
||||
|
||||
for wiz in self.browse(cr, uid, ids, context=context):
|
||||
|
@ -56,5 +55,5 @@ class hr_grant_badge_wizard(osv.TransientModel):
|
|||
}
|
||||
|
||||
badge_user = badge_user_obj.create(cr, uid, values, context=context)
|
||||
result = badge_obj.send_badge(cr, uid, wiz.badge_id.id, [badge_user], user_from=uid, context=context)
|
||||
result = badge_user_obj._send_badge(cr, uid, [badge_user], user_from=uid, context=context)
|
||||
return result
|
Loading…
Reference in New Issue