[REF] gamification

bzr revid: mat@openerp.com-20131217170232-e0zruxzl1wlycaji
This commit is contained in:
Martin Trigaux 2013-12-17 18:02:32 +01:00
parent c184adab44
commit 4bc29b9ffa
6 changed files with 19 additions and 18 deletions

View File

@ -81,7 +81,7 @@
<record model="gamification.challenge" id="challenge_base_discover">
<field name="name">Complete your Profile</field>
<field name="period">once</field>
<field name="visibility_mode">progressbar</field>
<field name="visibility_mode">personal</field>
<field name="report_message_frequency">never</field>
<field name="autojoin_group_id" eval="ref('base.group_user')" />
<field name="state">inprogress</field>
@ -91,7 +91,7 @@
<record model="gamification.challenge" id="challenge_base_configure">
<field name="name">Setup your Company</field>
<field name="period">once</field>
<field name="visibility_mode">progressbar</field>
<field name="visibility_mode">personal</field>
<field name="report_message_frequency">never</field>
<field name="user_ids" eval="[(4, ref('base.user_root'))]" />
<field name="state">inprogress</field>

View File

@ -101,6 +101,11 @@ class gamification_challenge(osv.Model):
res[challenge.id] = False
return res
def _get_categories(self, cr, uid, context=None):
return [
('hr', 'Human Ressources / Engagement'),
('other', 'Settings / Gamification Tools'),
]
_sort = 'end_date, start_date, name, id'
_columns = {
@ -153,8 +158,8 @@ class gamification_challenge(osv.Model):
'reward_failure': fields.boolean('Reward Bests if not Succeeded?'),
'visibility_mode': fields.selection([
('progressbar', 'Individual Goals'),
('board', 'Leader Board (Group Ranking)'),
('personal', 'Individual Goals'),
('ranking', 'Leader Board (Group Ranking)'),
],
string="Display Mode", required=True),
'report_message_frequency': fields.selection([
@ -174,20 +179,16 @@ class gamification_challenge(osv.Model):
help="Never reminded if no value or zero is specified."),
'last_report_date': fields.date('Last Report Date'),
'next_report_date': fields.function(_get_next_report_date,
type='date',
string='Next Report Date'),
type='date', string='Next Report Date', store=True),
'category': fields.selection([
('hr', 'Human Ressources / Engagement'),
('other', 'Settings / Gamification Tools'),
],
'category': fields.selection(lambda s, *a, **k: s._get_categories(*a, **k),
string="Appears in", help="Define the visibility of the challenge through menus", required=True),
}
_defaults = {
'period': 'once',
'state': 'draft',
'visibility_mode': 'progressbar',
'visibility_mode': 'personal',
'report_message_frequency': 'never',
'last_report_date': fields.date.today,
'start_date': fields.date.today,
@ -521,7 +522,7 @@ class gamification_challenge(osv.Model):
# template_env = TemplateHelper()
temp_obj = self.pool.get('email.template')
ctx = context.copy()
if challenge.visibility_mode == 'board':
if challenge.visibility_mode == 'ranking':
lines_boards = self.get_board_goal_info(cr, uid, challenge, subset_goal_ids, context)
ctx.update({'lines_boards': lines_boards})

View File

@ -72,7 +72,7 @@ class res_users_gamification_group(osv.Model):
user = self.browse(cr, uid, uid, context=context)
serialized_goals_info['currency'] = user.company_id.currency_id.id
if challenge.visibility_mode == 'board':
if challenge.visibility_mode == 'ranking':
# board report should be grouped by line for all users
goals_info = challenge_obj.get_board_goal_info(cr, uid, challenge, subset_goal_ids=False, context=context)

View File

@ -25,7 +25,7 @@
('user_id','=',user.id),
'&amp;',
('challenge_id.user_ids','in',user.id),
('challenge_id.visibility_mode','=','board')]</field>
('challenge_id.visibility_mode','=','ranking')]</field>
</record>
<record id="goal_gamification_manager_visibility" model="ir.rule">

View File

@ -10,7 +10,7 @@
<h4><t t-esc="challenge.name" /></h4>
</div>
<t t-if="challenge.visibility_mode == 'progressbar'">
<t t-if="challenge.visibility_mode == 'personal'">
<div class="oe_table oe_goals_list">
<div t-foreach="challenge.goals" t-as="goal" t-attf-class="oe_row oe_goal_outer_box #{goal.state == 'reached' ? 'oe_goal_reached' : ''} #{goal.definition_display != 'progress' ? 'oe_no_progress' : ''}">
<t t-if="goal.definition_display == 'progress'">
@ -42,7 +42,7 @@
</div>
</t>
<t t-if="challenge.visibility_mode == 'board'">
<t t-if="challenge.visibility_mode == 'ranking'">
<div t-foreach="challenge.lines" t-as="line" class="oe_goals_list oe_table">
<div class="oe_row">
<div class="oe_cell oe_thead" colspan="3" t-attf-title="#{line.definition_description ? line.definition_description : ''}">

View File

@ -129,7 +129,7 @@
<record model="gamification.challenge" id="challenge_crm_sale">
<field name="name">Monthly Sales Targets</field>
<field name="period">monthly</field>
<field name="visibility_mode">board</field>
<field name="visibility_mode">ranking</field>
<field name="autojoin_group_id" eval="ref('base.group_sale_salesman')" />
<field name="report_message_frequency">weekly</field>
<field name="report_header">The following message contains the current progress of the sale team based on several criterias. The progress is reinitialised each month and shared weekly.</field>
@ -138,7 +138,7 @@
<record model="gamification.challenge" id="challenge_crm_marketing">
<field name="name">Lead Acquisition</field>
<field name="period">monthly</field>
<field name="visibility_mode">progressbar</field>
<field name="visibility_mode">ranking</field>
<field name="autojoin_group_id" eval="ref('base.group_sale_salesman')" />
<field name="report_message_frequency">weekly</field>
<field name="report_header">The following message contains the current progress of the marketing team based on several criterias. The progress is reinitialised each month and shared weekly.</field>