diff --git a/addons/gamification/__openerp__.py b/addons/gamification/__openerp__.py index e966d9f3bad..5946e81224f 100644 --- a/addons/gamification/__openerp__.py +++ b/addons/gamification/__openerp__.py @@ -57,7 +57,6 @@ Both goals and badges are flexibles and can be adapted to a large range of modul 'js': [ 'static/src/js/gamification.js', 'static/src/js/justgage.js', - 'static/src/js/jquery.sparkline.2.1.1.min.js', ], 'qweb': ['static/src/xml/gamification.xml'], } diff --git a/addons/gamification/goal.py b/addons/gamification/goal.py index 3c1109ac44f..2377f5843c9 100644 --- a/addons/gamification/goal.py +++ b/addons/gamification/goal.py @@ -138,11 +138,17 @@ class gamification_goal(osv.Model): """Return the percentage of completeness of the goal, between 0 and 100""" res = {} for goal in self.browse(cr, uid, ids, context): - if goal.current > 0: - res[goal.id] = min(100, round(100.0 * goal.current / goal.target_goal, 2)) - else: - res[goal.id] = 0.0 - + # if goal.computation_mode == 'higher': + if goal.current > 0: + res[goal.id] = min(100, round(100.0 * goal.current / goal.target_goal, 2)) + else: + res[goal.id] = 0.0 + # else: + # # a goal 'lower than' has only two values possible: 0 or 100% + # if goal.current < goal.target_goal: + # res[goal.id] = 100.0 + # else: + # res[goal.id] = 0.0 return res def on_change_type_id(self, cr, uid, ids, type_id=False, context=None): diff --git a/addons/gamification/goal_base_data.xml b/addons/gamification/goal_base_data.xml index afd278e92a5..b1958475ce8 100644 --- a/addons/gamification/goal_base_data.xml +++ b/addons/gamification/goal_base_data.xml @@ -59,7 +59,7 @@ - Discover OpenERP + Set up your Profile once progressbar never diff --git a/addons/gamification/plan.py b/addons/gamification/plan.py index 4a47987e59d..5f75d8ecda4 100644 --- a/addons/gamification/plan.py +++ b/addons/gamification/plan.py @@ -106,46 +106,6 @@ class gamification_goal_plan(osv.Model): res[plan.id] = len(plan.planline_ids) return res - def _reward_id_many(self, cr, uid, ids, field_name, arg, context=None): - """Return the field reward_id as a many2many field""" - res = dict.fromkeys(ids, 0) - for plan in self.browse(cr, uid, ids, context): - if plan.reward_id: - res[plan.id] = [plan.reward_id.id] - else: - res[plan.id] = [] - return res - - def _reward_first_id_many(self, cr, uid, ids, field_name, arg, context=None): - """Return the field reward_first_id as a many2many field""" - res = dict.fromkeys(ids, 0) - for plan in self.browse(cr, uid, ids, context): - if plan.reward_first_id: - res[plan.id] = [plan.reward_first_id.id] - else: - res[plan.id] = [] - return res - - def _reward_second_id_many(self, cr, uid, ids, field_name, arg, context=None): - """Return the field reward_second_id as a many2many field""" - res = dict.fromkeys(ids, 0) - for plan in self.browse(cr, uid, ids, context): - if plan.reward_second_id: - res[plan.id] = [plan.reward_second_id.id] - else: - res[plan.id] = [] - return res - - def _reward_third_id_many(self, cr, uid, ids, field_name, arg, context=None): - """Return the field reward_third_id as a many2many field""" - res = dict.fromkeys(ids, 0) - for plan in self.browse(cr, uid, ids, context): - if plan.reward_third_id: - res[plan.id] = [plan.reward_third_id.id] - else: - res[plan.id] = [] - return res - _columns = { 'name': fields.char('Challenge Name', required=True, translate=True), 'description': fields.text('Description', translate=True), @@ -195,11 +155,6 @@ class gamification_goal_plan(osv.Model): 'reward_second_id': fields.many2one('gamification.badge', string="For 2nd user"), 'reward_third_id': fields.many2one('gamification.badge', string="For 3rd user"), 'reward_failure': fields.boolean('Reward Bests if not Succeeded?'), - # same fields but as many2many to be able to display as kanban - 'reward_id_many': fields.function(_reward_id_many, type="many2many", relation="gamification.badge", string="For Every Succeding User"), - 'reward_first_id_many': fields.function(_reward_first_id_many, type="many2many", relation="gamification.badge", string="For 1st user"), - 'reward_second_id_many': fields.function(_reward_second_id_many, type="many2many", relation="gamification.badge", string="For 2nd user"), - 'reward_third_id_many': fields.function(_reward_third_id_many, type="many2many", relation="gamification.badge", string="For 3rd user"), 'visibility_mode': fields.selection([ ('progressbar', 'Individual Goals'), @@ -261,12 +216,6 @@ class gamification_goal_plan(osv.Model): if new_group: self.plan_subscribe_users(cr, uid, ids, [user.id for user in new_group.users], context=context) - if 'proposed_user_ids' in vals: - for plan in self.browse(cr, uid, ids, context=context): - puser_ids = [puser.id for puser in plan.proposed_user_ids] - if len([user for user in plan.user_ids if user.id in puser_ids]) > 0: - raise osv.except_osv(_('Error!'), _('Can not propose a challenge to an user already assigned to it')) - return write_res ##### Update ##### diff --git a/addons/gamification/plan_view.xml b/addons/gamification/plan_view.xml index 4f2e71ad0bd..b1e79fa8ba5 100644 --- a/addons/gamification/plan_view.xml +++ b/addons/gamification/plan_view.xml @@ -233,19 +233,17 @@ gamification.goal.plan
- - - -

-
- This challenge has no starting and end date specified, it will be closed -
- The challenge is running from to + + + + + + @@ -262,64 +260,19 @@ There is no reward upon completion of this challenge. - - - - -
-
- -
-
-
-
- - - - -
-
- -
-
-
-
- - - - -
-
- -
-
-
-
- - - - -
-
- -
-
-
-
+ + + +
Even if the challenge is failed, best challengers will be rewarded
- -
Who will you be competiting with ?

- - -
diff --git a/addons/gamification/static/src/css/goal.css b/addons/gamification/static/src/css/goal.css index c113ac6ad2e..c4f74aae557 100644 --- a/addons/gamification/static/src/css/goal.css +++ b/addons/gamification/static/src/css/goal.css @@ -80,11 +80,8 @@ } /* mark goal as completed */ .openerp .oe_mail_wall_aside .oe_gamification_goal .oe_goal_reached { - /*text-decoration: line-through;*/ - color: rgb(17, 95, 17); -} -.openerp .oe_mail_wall_aside .oe_gamification_goal .oe_goal_failed { - color: rgb(95, 17, 17); + text-decoration: line-through; + color: rgb(138, 137, 137); } .openerp .oe_mail_wall_aside .oe_goals_list { @@ -94,7 +91,7 @@ width: 200px; } .openerp .oe_mail_wall .oe_mail_wall_aside .oe_goal_outer_box { - background: rgb(173, 219, 178); + background: rgb(213, 213, 213); min-height: 32px; } .openerp .oe_mail_wall_aside .oe_goals_list .oe_goal_inner_box { @@ -110,8 +107,12 @@ .openerp .oe_mail_wall_aside .oe_goals_list .oe_goal_inner_box strong { padding-left: 5px; } -.openerp .oe_mail_wall .oe_mail_wall_aside table { +.openerp .oe_mail_wall .oe_mail_wall_aside table.oe_goals_list { margin: 10px 0; + border: solid 1px white; +} +.openerp .oe_mail_wall .oe_mail_wall_aside .oe_goals_list thead { + font-weight: normal; } .oe_mail_wall_aside .oe_goals_list tbody tr:nth-child(even) { background-color: #fff; @@ -122,6 +123,7 @@ border: none; } .openerp .oe_mail_wall_aside .oe_goals_list thead th { + font-weight: normal; padding: 5px; } .openerp .oe_mail_wall_aside .oe_goals_list tbody tr { diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index 41b6125a4c9..edfc304f83f 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -79,8 +79,6 @@ openerp.gamification = function(instance) { if(self.goals_info.info.length > 0){ self.render_template_replace(self.$el.filter(".oe_gamification_goal"),'gamification.goal_list_to_do'); self.render_money_fields(self.goals_info.info[0].currency); - // self.render_progress_bars(); - self.render_piechars(); self.render_user_avatars(); } else { self.$el.filter(".oe_gamification_goal").hide(); @@ -117,29 +115,6 @@ openerp.gamification = function(instance) { money_field.replace($(this)); }); }, - render_progress_bars: function() { - var self = this; - - dfm = new instance.web.form.DefaultFieldManager(self); - // Generate a FieldMonetary for each .oe_goal_field_monetary - self.$(".oe_goal_progress").each(function() { - progress_field = new instance.web.form.FieldProgressBar(dfm, { - attrs: { - modifiers: '{"readonly": true}' - } - }); - progress_field.set('value', $(this).attr('value')); - progress_field.replace($(this)); - }); - }, - render_piechars: function() { - var self = this; - self.$(".oe_goal_sparkline_piechart").each(function() { - var completeness = parseInt( $(this).attr('data-completeness'), 10); - var values = [completeness, 100-completeness]; - $(this).sparkline(values, {type: 'pie', offset: 180, sliceColors: ['#0B610B','#F78181']}); - }); - }, render_user_avatars: function() { var self = this; self.$(".oe_user_avatar").each(function() { diff --git a/addons/gamification/static/src/xml/gamification.xml b/addons/gamification/static/src/xml/gamification.xml index e3782a7d22b..c83862af829 100644 --- a/addons/gamification/static/src/xml/gamification.xml +++ b/addons/gamification/static/src/xml/gamification.xml @@ -11,13 +11,12 @@
-
+
- - + & - +
@@ -38,11 +37,11 @@
- +
-
- +
(Goal: max ) & @@ -55,11 +54,10 @@
+
- - +
@@ -77,7 +75,7 @@ You have been invited to the following challenges: diff --git a/addons/gamification_sale_crm/sale_crm_goals.xml b/addons/gamification_sale_crm/sale_crm_goals.xml index 7ca2e006697..1977ed80c33 100644 --- a/addons/gamification_sale_crm/sale_crm_goals.xml +++ b/addons/gamification_sale_crm/sale_crm_goals.xml @@ -124,7 +124,6 @@ - Monthly Sales Targets @@ -150,11 +149,6 @@ 20000 - - - 4 - - diff --git a/addons/gamification_sale_crm/sale_crm_goals_demo.xml b/addons/gamification_sale_crm/sale_crm_goals_demo.xml index 679d80e3472..f38e1ae75bf 100644 --- a/addons/gamification_sale_crm/sale_crm_goals_demo.xml +++ b/addons/gamification_sale_crm/sale_crm_goals_demo.xml @@ -18,16 +18,6 @@ 2000 inprogress - - - - - - - - 4 - inprogress -