From 90dfa5895d61fae037046aea2b64b25d9903df15 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 18 Dec 2013 15:03:33 +0100 Subject: [PATCH] [FIX] gamification: send badge on user, fix function field bzr revid: mat@openerp.com-20131218140333-nipcc21z5snhac1c --- addons/gamification/models/badge.py | 2 +- addons/hr_gamification/models/gamification.py | 3 +-- addons/hr_gamification/wizard/grant_badge.py | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/addons/gamification/models/badge.py b/addons/gamification/models/badge.py index 4f11c4192f0..99ad7f93edd 100644 --- a/addons/gamification/models/badge.py +++ b/addons/gamification/models/badge.py @@ -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), diff --git a/addons/hr_gamification/models/gamification.py b/addons/hr_gamification/models/gamification.py index 3c92514f338..27c1834bc39 100644 --- a/addons/hr_gamification/models/gamification.py +++ b/addons/hr_gamification/models/gamification.py @@ -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"), } diff --git a/addons/hr_gamification/wizard/grant_badge.py b/addons/hr_gamification/wizard/grant_badge.py index 539781216e1..967324b7b87 100644 --- a/addons/hr_gamification/wizard/grant_badge.py +++ b/addons/hr_gamification/wizard/grant_badge.py @@ -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 \ No newline at end of file