diff --git a/addons/gamification/data/gamification_karma_rank_data.xml b/addons/gamification/data/gamification_karma_rank_data.xml index 616c143d985..cb0e5a3e41b 100644 --- a/addons/gamification/data/gamification_karma_rank_data.xml +++ b/addons/gamification/data/gamification_karma_rank_data.xml @@ -6,7 +6,7 @@ Newbie

You just began the adventure! Welcome!

Keep going !

- 1 + 1 diff --git a/addons/gamification/data/gamification_karma_rank_demo.xml b/addons/gamification/data/gamification_karma_rank_demo.xml index d9c89691b3a..5b1f7f9661a 100644 --- a/addons/gamification/data/gamification_karma_rank_demo.xml +++ b/addons/gamification/data/gamification_karma_rank_demo.xml @@ -5,7 +5,7 @@ Student

You begin to understand things ! Keep going!

Keep going !

- 100 + 100 @@ -13,7 +13,7 @@ Bachelor

Hey ! You're not so dumb after all !

Keep going !

- 500 + 500 @@ -21,7 +21,7 @@ Master

You're good ! Really Good !

Keep going !

- 2000 + 2000 @@ -29,7 +29,7 @@ Doctor

Ok, RESPECT !

Keep going !

- 10000 + 10000 diff --git a/addons/gamification/models/gamification_karma_rank.py b/addons/gamification/models/gamification_karma_rank.py index 26b89a3db33..e5a7897f44c 100644 --- a/addons/gamification/models/gamification_karma_rank.py +++ b/addons/gamification/models/gamification_karma_rank.py @@ -15,14 +15,14 @@ class KarmaError(Forbidden): class KarmaRank(models.Model): _name = 'gamification.karma.rank' _description = 'Rank based on karma' - _order = 'karma_required' + _order = 'karma_min' name = fields.Text(string='Rank Name', translate=True, required=True) description = fields.Html(string='Description', translate=html_translate, sanitize_attributes=False,) description_reach_next = fields.Html( string='Motivation phrase', translate=html_translate, sanitize_attributes=False, help="Motivation phrase to reach next rank") - karma_required = fields.Integer(string='Required Karma', help='Minimum karma needed to reach this rank') + karma_min = fields.Integer(string='Required Karma', help='Minimum karma needed to reach this rank') user_ids = fields.One2many('res.users', 'rank_id', string='Users', help="Users having this rank") image = fields.Binary('Rank Icon') image_medium = fields.Binary( diff --git a/addons/gamification/models/res_users.py b/addons/gamification/models/res_users.py index d7fd35769df..99f673a78a9 100644 --- a/addons/gamification/models/res_users.py +++ b/addons/gamification/models/res_users.py @@ -58,7 +58,7 @@ class Users(models.Model): return True def _rank_changed(self): - if self.rank_id.karma_required > 0: + if self.rank_id.karma_min > 0: template = self.env.ref('gamification.mail_template_data_new_rank_reached', raise_if_not_found=False) if template: template.send_mail(self.id, force_send=True, notif_layout='mail.mail_notification_light') @@ -68,11 +68,11 @@ class Users(models.Model): The caller should filter the users on karma > 0 before calling this method to avoid looping on every single users """ - ranks = [{'rank': rank, 'karma_required': rank.karma_required} for rank in - self.env['gamification.karma.rank'].search([], order="karma_required DESC")] + ranks = [{'rank': rank, 'karma_min': rank.karma_min} for rank in + self.env['gamification.karma.rank'].search([], order="karma_min DESC")] for user in self: for i in range(0, len(ranks)): - if user.karma >= ranks[i]['karma_required']: + if user.karma >= ranks[i]['karma_min']: if user.rank_id != ranks[i]['rank']: user.rank_id = ranks[i]['rank'].id user.next_rank_id = ranks[i - 1]['rank'].id if i > 0 else False diff --git a/addons/gamification/views/gamification_karma_rank_views.xml b/addons/gamification/views/gamification_karma_rank_views.xml index d0d84c5114f..1e12a283cce 100644 --- a/addons/gamification/views/gamification_karma_rank_views.xml +++ b/addons/gamification/views/gamification_karma_rank_views.xml @@ -21,7 +21,7 @@ - + @@ -34,7 +34,7 @@ - + @@ -56,7 +56,7 @@ - +