From 56b3db82192d6ed2dad45982ebce9f471cf7c0cf Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 12 Sep 2014 10:37:14 +0200 Subject: [PATCH] [IMP] gamification: usability and shit Challenge - 'Reward as soon as every goal is reached' box checked by default (most of the time people want this behaviour, few special cases were do not) - Click on challenge kanban opens goal list instead of challenge form - Add button 'Start Challenge' clicking on statusbar is not intuitive Badge - When creates a challenge from badge view, set by default badge to 'For Every Succeding User' field - replace filter 'Current' vs 'Passed' by 'Running' (in progress and done with not reached end date) vs 'Done' (done & failed without end date or end date passed) Goal - list of badge on employee form not the first tab --- addons/gamification/models/challenge.py | 6 +++++- .../gamification/static/src/js/gamification.js | 11 ----------- addons/gamification/views/badge.xml | 2 +- addons/gamification/views/challenge.xml | 9 ++------- addons/gamification/views/goal.xml | 16 ++++++++++++---- addons/hr_gamification/views/gamification.xml | 4 +--- 6 files changed, 21 insertions(+), 27 deletions(-) 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 @@
+