diff --git a/addons/gamification/models/challenge.py b/addons/gamification/models/challenge.py index 2a1c6d5b0a5..4e128fc8f12 100644 --- a/addons/gamification/models/challenge.py +++ b/addons/gamification/models/challenge.py @@ -204,6 +204,7 @@ class gamification_challenge(osv.Model): 'category': 'hr', 'reward_failure': False, 'report_template_id': lambda s, *a, **k: s._get_report_template(*a, **k), + 'reward_realtime': True, } @@ -361,6 +362,9 @@ class gamification_challenge(osv.Model): return True + def action_start(self, cr, uid, ids, context=None): + """Start a challenge""" + return self.write(cr, uid, ids, {'state': 'inprogress'}, context=context) def action_check(self, cr, uid, ids, context=None): """Check a challenge @@ -707,7 +711,7 @@ class gamification_challenge(osv.Model): rewarded_users = [] challenge_ended = end_date == yesterday.strftime(DF) or force - if challenge.reward_id and challenge_ended or challenge.reward_realtime: + if challenge.reward_id and (challenge_ended or challenge.reward_realtime): # not using start_date as intemportal goals have a start date but no end_date reached_goals = self.pool.get('gamification.goal').read_group(cr, uid, [ ('challenge_id', '=', challenge.id), diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index 6e2e5201968..0c02162e59f 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -125,16 +125,5 @@ openerp.gamification = function(instance) { sidebar.appendTo($('.oe_mail_wall_aside')); }, }); - - instance.web_kanban.KanbanRecord.include({ - // open related goals when clicking on challenge kanban view - on_card_clicked: function() { - if (this.view.dataset.model === 'gamification.challenge') { - this.$('.oe_kanban_project_list a').first().click(); - } else { - this._super.apply(this, arguments); - } - }, - }); }; diff --git a/addons/gamification/views/badge.xml b/addons/gamification/views/badge.xml index 302ad66caf0..315ccd68308 100644 --- a/addons/gamification/views/badge.xml +++ b/addons/gamification/views/badge.xml @@ -75,7 +75,7 @@ - + diff --git a/addons/gamification/views/challenge.xml b/addons/gamification/views/challenge.xml index 9c76b73bdae..75515c42183 100644 --- a/addons/gamification/views/challenge.xml +++ b/addons/gamification/views/challenge.xml @@ -34,6 +34,7 @@
+