[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
This commit is contained in:
parent
764c5acd81
commit
56b3db8219
|
@ -204,6 +204,7 @@ class gamification_challenge(osv.Model):
|
||||||
'category': 'hr',
|
'category': 'hr',
|
||||||
'reward_failure': False,
|
'reward_failure': False,
|
||||||
'report_template_id': lambda s, *a, **k: s._get_report_template(*a, **k),
|
'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
|
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):
|
def action_check(self, cr, uid, ids, context=None):
|
||||||
"""Check a challenge
|
"""Check a challenge
|
||||||
|
@ -707,7 +711,7 @@ class gamification_challenge(osv.Model):
|
||||||
|
|
||||||
rewarded_users = []
|
rewarded_users = []
|
||||||
challenge_ended = end_date == yesterday.strftime(DF) or force
|
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
|
# 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, [
|
reached_goals = self.pool.get('gamification.goal').read_group(cr, uid, [
|
||||||
('challenge_id', '=', challenge.id),
|
('challenge_id', '=', challenge.id),
|
||||||
|
|
|
@ -126,15 +126,4 @@ openerp.gamification = function(instance) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -75,7 +75,7 @@
|
||||||
</div>
|
</div>
|
||||||
</group>
|
</group>
|
||||||
<group string="Rewards for challenges">
|
<group string="Rewards for challenges">
|
||||||
<field name="challenge_ids" widget="many2many_kanban" nolabel="1" />
|
<field name="challenge_ids" widget="many2many_kanban" nolabel="1" context="{'default_reward_id': active_id}" />
|
||||||
</group>
|
</group>
|
||||||
<group string="Statistics">
|
<group string="Statistics">
|
||||||
<group>
|
<group>
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Goal definitions">
|
<form string="Goal definitions">
|
||||||
<header>
|
<header>
|
||||||
|
<button string="Start Challenge" type="object" name="action_start" states="draft" class="oe_highlight"/>
|
||||||
<button string="Refresh Challenge" type="object" name="action_check" states="inprogress"/>
|
<button string="Refresh Challenge" type="object" name="action_check" states="inprogress"/>
|
||||||
<button string="Send Report" type="object" name="action_report_progress" states="inprogress,done" groups="base.group_no_one"/>
|
<button string="Send Report" type="object" name="action_report_progress" states="inprogress,done" groups="base.group_no_one"/>
|
||||||
<field name="state" widget="statusbar" clickable="True"/>
|
<field name="state" widget="statusbar" clickable="True"/>
|
||||||
|
@ -48,7 +49,7 @@
|
||||||
<label for="user_domain" class="oe_edit_only" string="Assign Challenge To"/>
|
<label for="user_domain" class="oe_edit_only" string="Assign Challenge To"/>
|
||||||
<div>
|
<div>
|
||||||
<field name="user_domain" widget="char_domain" options="{'model': 'res.users'}" />
|
<field name="user_domain" widget="char_domain" options="{'model': 'res.users'}" />
|
||||||
<field name="user_ids" groups="base.group_no_one" widget="many2many_tags" />
|
<field name="user_ids" groups="base.group_no_one" widget="many2many_tags" readonly="True" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -142,12 +143,6 @@
|
||||||
<templates>
|
<templates>
|
||||||
<t t-name="kanban-box">
|
<t t-name="kanban-box">
|
||||||
<div t-attf-class="oe_kanban_card oe_kanban_goal oe_kanban_global_click">
|
<div t-attf-class="oe_kanban_card oe_kanban_goal oe_kanban_global_click">
|
||||||
<div class="oe_dropdown_toggle oe_dropdown_kanban">
|
|
||||||
<span class="oe_e">í</span>
|
|
||||||
<ul class="oe_dropdown_menu">
|
|
||||||
<li><a type="edit">Configure Challenge</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="oe_kanban_content">
|
<div class="oe_kanban_content">
|
||||||
<strong>
|
<strong>
|
||||||
<h4 class="text-center"><field name="name"/></h4>
|
<h4 class="text-center"><field name="name"/></h4>
|
||||||
|
|
|
@ -98,13 +98,21 @@
|
||||||
<filter name="my" string="My Goals" domain="[('user_id', '=', uid)]"/>
|
<filter name="my" string="My Goals" domain="[('user_id', '=', uid)]"/>
|
||||||
<separator/>
|
<separator/>
|
||||||
<filter name="draft" string="Draft" domain="[('state', '=', 'draft')]"/>
|
<filter name="draft" string="Draft" domain="[('state', '=', 'draft')]"/>
|
||||||
<filter name="inprogress" string="Current"
|
<filter name="inprogress" string="Running"
|
||||||
domain="[
|
domain="[
|
||||||
'|',
|
'|',
|
||||||
('state', '=', 'inprogress'),
|
('state', '=', 'inprogress'),
|
||||||
|
'&',
|
||||||
|
('state', 'in', ('done', 'failed')),
|
||||||
('end_date', '>=', context_today().strftime('%%Y-%%m-%%d'))
|
('end_date', '>=', context_today().strftime('%%Y-%%m-%%d'))
|
||||||
]"/>
|
]"/>
|
||||||
<filter name="closed" string="Passed" domain="[('state', 'in', ('reached', 'failed'))]"/>
|
<filter name="closed" string="Done"
|
||||||
|
domain="[
|
||||||
|
('state', 'in', ('reached', 'failed')),
|
||||||
|
'|',
|
||||||
|
('end_date', '=', False),
|
||||||
|
('end_date', '<', context_today().strftime('%%Y-%%m-%%d'))
|
||||||
|
]"/>
|
||||||
<separator/>
|
<separator/>
|
||||||
|
|
||||||
<field name="user_id"/>
|
<field name="user_id"/>
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<field name="inherit_id" ref="hr.view_employee_form"/>
|
<field name="inherit_id" ref="hr.view_employee_form"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
|
|
||||||
<xpath expr="//page[@string='Public Information']" position="before">
|
<xpath expr="//page[@string='Public Information']" position="after">
|
||||||
<page string="Received Badges" attrs="{'invisible': [('user_id', '=', False)]}">
|
<page string="Received Badges" attrs="{'invisible': [('user_id', '=', False)]}">
|
||||||
<field name="has_badges" invisible="1"/>
|
<field name="has_badges" invisible="1"/>
|
||||||
<button string="Grant a Badge" type="action" name="%(action_reward_wizard)d"/> to reward this employee for a good action
|
<button string="Grant a Badge" type="action" name="%(action_reward_wizard)d"/> to reward this employee for a good action
|
||||||
|
@ -34,8 +34,6 @@
|
||||||
</div>
|
</div>
|
||||||
<field name="badge_ids" widget="many2many_kanban" />
|
<field name="badge_ids" widget="many2many_kanban" />
|
||||||
</page>
|
</page>
|
||||||
</xpath>
|
|
||||||
<xpath expr="//page[@string='Public Information']" position="after">
|
|
||||||
<page string="Goals">
|
<page string="Goals">
|
||||||
<field name="goal_ids" widget="many2many_kanban" />
|
<field name="goal_ids" widget="many2many_kanban" />
|
||||||
</page>
|
</page>
|
||||||
|
|
Loading…
Reference in New Issue