diff --git a/addons/gamification/badge.py b/addons/gamification/badge.py index 7ff80fc3967..f53683fbd91 100644 --- a/addons/gamification/badge.py +++ b/addons/gamification/badge.py @@ -27,8 +27,6 @@ from openerp.tools.safe_eval import safe_eval from templates import TemplateHelper from datetime import date -import base64 - class gamification_badge_user(osv.Model): """User having received a badge""" @@ -71,6 +69,17 @@ class gamification_badge(osv.Model): result[obj.id] = len(obj.owner_ids) return result + def _get_unique_global_list(self, cr, uid, ids, name, args, context=None): + """Return the list of unique res.users ids having received this badge""" + result = dict.fromkeys(ids, False) + for obj in self.browse(cr, uid, ids, context=context): + res = self.pool.get('gamification.badge.user').read_group( + cr, uid, domain=[('badge_id', '=', obj.id)], + fields=['badge_id', 'user_id'], + groupby=['user_id'], context=context) + result[obj.id] = [badge_user['user_id'][0] for badge_user in res] + return result + def _get_unique_global_count(self, cr, uid, ids, name, args, context=None): """Return the number of time this badge has been granted to individual users""" result = dict.fromkeys(ids, False) @@ -171,6 +180,10 @@ class gamification_badge(osv.Model): help="A message will be posted on the user profile or just sent to him"), 'owner_ids': fields.one2many('gamification.badge.user', 'badge_id', string='Owners', help='The list of instances of this badge granted to users'), + 'unique_owner_ids': fields.function(_get_unique_global_list, + string='Unique Owners', + help="The list of unique users having received this badge.", + type="many2many", relation="res.users"), 'stat_count': fields.function(_get_global_count, string='Total', help="The number of time this badge has been received."), diff --git a/addons/gamification/badge_view.xml b/addons/gamification/badge_view.xml index cdb2c4dcac0..c6e08a9763a 100644 --- a/addons/gamification/badge_view.xml +++ b/addons/gamification/badge_view.xml @@ -124,6 +124,7 @@ +
@@ -147,9 +148,9 @@ jspW8F2wIbhtSRr0Vf4AD6Nod0TaN4kAAAAASUVORK5CYII=" alt="got-it" /> -->

Granted x ( pers.)

-
- - +
+ +
diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index 030aca800d2..f3134f704b8 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -19,6 +19,16 @@ } +.oe_kanban_badge_avatars img { + width: 30px; + height: 30px; + padding-left: 0; + margin-top: 3px; + border-radius: 2px; + -box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); +} + + /* Mail Sidebar */ .openerp .oe_mail_wall .oe_mail_wall_aside {