[REF] moving to only hr_gamification module

bzr revid: mat@openerp.com-20130416124558-p40tkw8mgr4e7v04
This commit is contained in:
Martin Trigaux 2013-04-16 14:45:58 +02:00
parent 8d23c604d9
commit 0b0c24a636
15 changed files with 83 additions and 108 deletions

View File

@ -103,7 +103,8 @@
<group string="Rewards for challenges">
<field name="plan_ids" widget="many2many_kanban" nolabel="1" />
</group>
<!-- <group string="Rules for Automatic Granting">
<!--
<group string="Rules for Automatic Granting">
<field name="rule_automatic" widget="radio"/>
<field name="compute_code" attrs="{'invisible': [('rule_automatic','!=','python')]}"/>
<field name="goal_type_ids" attrs="{'invisible': [('rule_automatic','!=','goals')]}" widget="many2many_tags"/>
@ -144,12 +145,6 @@
<t t-name="kanban-box">
<div t-attf-class="#{record.stat_my.raw_value ? 'oe_kanban_color_5' : 'oe_kanban_color_white'} oe_kanban_card oe_kanban_global_click oe_kanban_badge">
<div class="oe_kanban_content">
<div class="oe_dropdown_toggle oe_dropdown_kanban">
<span class="oe_e">í</span>
<ul class="oe_dropdown_menu">
<li><a type="open">Badge Details</a></li>
</ul>
</div>
<div class="oe_kanban_left">
<a type="open"><img t-att-src="kanban_image('gamification.badge', 'image', record.image.raw_value)" t-att-title="record.name.value" width="110" height="110" /></a>
</div>
@ -173,7 +168,7 @@
</span>
</t>
<t t-if="record.remaining_sending.value == 0">
<div class="oe_grey">Can not send</div>
<div class="oe_grey">Can not grant</div>
</t>
</div>
<div class="oe_kanban_badge_avatars">

View File

@ -645,8 +645,7 @@ class gamification_goal_planline(osv.Model):
'target_goal': fields.float('Target Value to Reach',
required=True),
'sequence': fields.integer('Sequence',
help='Sequence number for ordering',
required=True),
help='Sequence number for ordering'),
'sequence_type': fields.related('type_id', 'sequence',
type='integer',
string='Sequence',

View File

@ -98,6 +98,7 @@
<field name="type_full_suffix"/>
</tree>
</field>
<field name="description" placeholder="Describe the challenge: what is does, who it targets, why it matters..."/>
</page>
<page string="Reward">
<group>
@ -133,9 +134,6 @@
</group>
</page>
</notebook>
<group>
<field name="description" placeholder="Describe the challenge: what is does, who it targets, why it matters..."/>
</group>
</sheet>
<div class="oe_chatter">

View File

@ -19,26 +19,6 @@
<field name="state">inprogress</field>
</record>
<record model="gamification.goal" id="goal_crm_sale3">
<field name="type_id" eval="ref('type_crm_nbr_sale_order_created')" />
<field name="user_id" eval="ref('base.user_demo')" />
<field name="planline_id" eval="ref('planline_crm_sale3')" />
<field name="start_date" eval="time.strftime('2013-03-01')" />
<field name="end_date" eval="time.strftime('2013-03-31')" />
<field name="target_goal">5</field>
<field name="state">inprogress</field>
</record>
<record model="gamification.goal" id="goal_crm_sale4">
<field name="type_id" eval="ref('type_crm_nbr_paid_sale_order')" />
<field name="user_id" eval="ref('base.user_demo')" />
<field name="planline_id" eval="ref('planline_crm_sale4')" />
<field name="start_date" eval="time.strftime('2013-03-01')" />
<field name="end_date" eval="time.strftime('2013-03-31')" />
<field name="target_goal">5</field>
<field name="state">inprogress</field>
</record>
<record model="gamification.goal" id="goal_crm_sale5">
<field name="type_id" eval="ref('type_crm_nbr_customer_refunds')" />
<field name="user_id" eval="ref('base.user_demo')" />

View File

@ -28,7 +28,7 @@
'website': 'http://www.openerp.com',
'summary': 'Periodical Evaluations, Appraisals, Surveys',
'images': ['images/hr_evaluation_analysis.jpeg','images/hr_evaluation.jpeg','images/hr_interview_requests.jpeg'],
'depends': ['hr','base_calendar','survey','gamification'],
'depends': ['hr','base_calendar','survey'],
'description': """
Periodical Employees evaluation and appraisals
==============================================

View File

@ -105,17 +105,9 @@ class hr_employee(osv.osv):
_inherit="hr.employee"
def _get_employee_goals(self, cr, uid, ids, field_name, arg, context=None):
"""Return the list of goals assigned to the employee"""
res = {}
for employee in self.browse(cr, uid, ids, context=context):
res[employee.id] = self.pool.get('gamification.goal').search(cr,uid,[('user_id', '=', employee.user_id.id), ('plan_id.category', '=', 'hr')], context=context)
return res
_columns = {
'evaluation_plan_id': fields.many2one('hr_evaluation.plan', 'Appraisal Plan'),
'evaluation_date': fields.date('Next Appraisal Date', help="The date of the next appraisal is computed by the appraisal plan's dates (first appraisal + periodicity)."),
'goal_ids': fields.function(_get_employee_goals, type="one2many", obj='gamification.goal', string="Employee HR Goals")
}
def run_employee_evaluation(self, cr, uid, automatic=False, use_new_cursor=False, context=None):
now = parser.parse(datetime.now().strftime('%Y-%m-%d'))

View File

@ -147,11 +147,6 @@
<xpath expr="//div[@name='button_box']" position="inside">
<button name="%(act_hr_employee_2_hr__evaluation_interview)d" string="Appraisal Interviews" type="action"/>
</xpath>
<xpath expr="//page[@string='Public Information']" position="after">
<page string="Goals">
<field name="goal_ids" widget="many2many_kanban" />
</page>
</xpath>
</field>
</record>
@ -413,47 +408,8 @@
<field name="act_window_id" ref="action_hr_evaluation_interview_tree"/>
</record>
<record id="goals_menu_groupby_action2" model="ir.actions.act_window">
<field name="res_model">gamification.goal</field>
<field name="view_type">form</field>
<field name="name">Goals History</field>
<field name="view_mode">tree,kanban</field>
<field name="context">{'search_default_group_by_user': True, 'search_default_group_by_type': True}</field>
<field name="domain">[('plan_id.category', '=', 'hr')]</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a goal.
</p>
<p>
A goal is defined by a user and a goal type.
Goals can be created automatically by using goal plans.
</p>
</field>
</record>
<record id="goal_plan_list_action2" model="ir.actions.act_window">
<field name="name">Challenges</field>
<field name="res_model">gamification.goal.plan</field>
<field name="view_mode">kanban,tree,form</field>
<field name="domain">[('category', '=', 'hr')]</field>
<field name="context">{'search_default_inprogress':True, 'default_inprogress':True}</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a challenge.
</p>
<p>
Assign a list of goals to chosen users to evaluate them.
The challenge can use a period (weekly, monthly...) for automatic creation of goals.
The goals are created for the specified users or member of the group.
</p>
</field>
</record>
<menuitem name="Interview Requests" parent="menu_eval_hr" id="menu_open_hr_evaluation_interview_requests"
action="action_hr_evaluation_interview_tree"/>
<menuitem id="gamification_plan_menu_hr" parent="menu_eval_hr" action="goal_plan_list_action2" groups="base.group_hr_user"/>
<menuitem id="gamification_goal_menu_hr" parent="menu_eval_hr" action="goals_menu_groupby_action2" groups="base.group_hr_user"/>
<!-- Email Compose message Action-->
<act_window

View File

@ -2,7 +2,7 @@
<openerp>
<data noupdate="0">
<!-- make Employee users Survey users and Gamification manager -->
<!-- make Employee users Survey users -->
<record id="base.group_user" model="res.groups">
<field name="implied_ids" eval="[(4, ref('base.group_survey_user'))]"/>
</record>

View File

@ -39,9 +39,4 @@ access_survey_response_hr_employee,survey.response.employee,survey.model_survey_
access_survey_question_column_heading_hr_employee,survey.question.column.heading.employee,survey.model_survey_question_column_heading,base.group_user,1,0,0,0
access_survey_response_line_hr_employee,survey.response.line.employee,survey.model_survey_response_line,base.group_user,1,1,1,0
access_survey_response_answer_hr_employee,survey.response.answer.hr.employee,survey.model_survey_response_answer,base.group_user,1,1,1,0
access_survey_tbl_column_heading_hr_employee,survey.tbl.column.heading,survey.model_survey_tbl_column_heading,base.group_user,1,1,1,0
plan_officer,"Goal Plan Officer",gamification.model_gamification_goal_plan,base.group_hr_user,1,1,1,1
planline_officer,"Goal Planline Officer",gamification.model_gamification_goal_planline,base.group_hr_user,1,1,1,1
badge_officer,"Badge Officer",gamification.model_gamification_badge,base.group_hr_user,1,1,1,1
badge_user_officer,"Badge-user Officer",gamification.model_gamification_badge_user,base.group_hr_user,1,1,1,1
access_survey_tbl_column_heading_hr_employee,survey.tbl.column.heading,survey.model_survey_tbl_column_heading,base.group_user,1,1,1,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
39 access_survey_question_column_heading_hr_employee survey.question.column.heading.employee survey.model_survey_question_column_heading base.group_user 1 0 0 0
40 access_survey_response_line_hr_employee survey.response.line.employee survey.model_survey_response_line base.group_user 1 1 1 0
41 access_survey_response_answer_hr_employee survey.response.answer.hr.employee survey.model_survey_response_answer base.group_user 1 1 1 0
42 access_survey_tbl_column_heading_hr_employee survey.tbl.column.heading survey.model_survey_tbl_column_heading base.group_user 1 1 1 0
plan_officer Goal Plan Officer gamification.model_gamification_goal_plan base.group_hr_user 1 1 1 1
planline_officer Goal Planline Officer gamification.model_gamification_goal_planline base.group_hr_user 1 1 1 1
badge_officer Badge Officer gamification.model_gamification_badge base.group_hr_user 1 1 1 1
badge_user_officer Badge-user Officer gamification.model_gamification_badge_user base.group_hr_user 1 1 1 1

View File

@ -1 +1 @@
import badge
import gamification

View File

@ -24,11 +24,16 @@
'author': 'OpenERP SA',
'category': 'HR',
'depends': ['gamification', 'hr'],
'description': """Use the HR ressources for the gamification process of goals.
'description': """Use the HR ressources for the gamification process.
The HR officer can now manage challenges and badges.
This allow the user to send badges to employees instead of simple users.
Badge received are displayed on the user profile.""",
'data': ['badge_view.xml'],
Badge received are displayed on the user profile.
""",
'data': [
'security/ir.model.access.csv',
'gamification_view.xml',
],
'auto_install': True,
'js': ['static/src/js/badges.js'],
'js': ['static/src/js/gamification.js'],
}

View File

@ -130,6 +130,13 @@ class hr_employee(osv.osv):
_name = "hr.employee"
_inherit = "hr.employee"
def _get_employee_goals(self, cr, uid, ids, field_name, arg, context=None):
"""Return the list of goals assigned to the employee"""
res = {}
for employee in self.browse(cr, uid, ids, context=context):
res[employee.id] = self.pool.get('gamification.goal').search(cr,uid,[('user_id', '=', employee.user_id.id), ('plan_id.category', '=', 'hr')], context=context)
return res
def _get_employee_badges(self, cr, uid, ids, field_name, arg, context=None):
"""Return the list of badge_users assigned to the employee"""
res = {}
@ -148,6 +155,7 @@ class hr_employee(osv.osv):
return res
_columns = {
'goal_ids': fields.function(_get_employee_goals, type="one2many", obj='gamification.goal', string="Employee HR Goals"),
'badge_ids': fields.function(_get_employee_badges, type="one2many",
obj='gamification.badge.user', string="Employee Badges"),
'has_badges': fields.function(_has_badges, type="boolean", string="Has Badges"),

View File

@ -23,9 +23,6 @@
</field>
</record>
<menuitem id="gamification_badge_menu_hr" parent="hr.menu_hr_main" action="gamification.badge_list_action" />
<record id="gamification.view_badge_wizard_reward" model="ir.ui.view">
<field name="name">Reward Employee Badge Form</field>
<field name="model">gamification.badge.user.wizard</field>
@ -86,7 +83,58 @@
<field name="badge_ids" widget="many2many_kanban" />
</page>
</xpath>
<xpath expr="//page[@string='Public Information']" position="after">
<page string="Goals">
<field name="goal_ids" widget="many2many_kanban" />
</page>
</xpath>
</field>
</record>
<record id="goals_menu_groupby_action2" model="ir.actions.act_window">
<field name="res_model">gamification.goal</field>
<field name="view_type">form</field>
<field name="name">Goals History</field>
<field name="view_mode">tree,kanban</field>
<field name="context">{'search_default_group_by_user': True, 'search_default_group_by_type': True}</field>
<field name="domain">[('plan_id.category', '=', 'hr')]</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a goal.
</p>
<p>
A goal is defined by a user and a goal type.
Goals can be created automatically by using goal plans.
</p>
</field>
</record>
<record id="goal_plan_list_action2" model="ir.actions.act_window">
<field name="name">Challenges</field>
<field name="res_model">gamification.goal.plan</field>
<field name="view_mode">kanban,tree,form</field>
<field name="domain">[('category', '=', 'hr')]</field>
<field name="context">{'search_default_inprogress':True, 'default_inprogress':True}</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a challenge.
</p>
<p>
Assign a list of goals to chosen users to evaluate them.
The challenge can use a period (weekly, monthly...) for automatic creation of goals.
The goals are created for the specified users or member of the group.
</p>
</field>
</record>
<menuitem id="menu_hr_gamification" parent="hr.menu_hr_root" name="Engagement" sequence="40"/>
<menuitem id="gamification_badge_menu_hr" parent="menu_hr_gamification" action="gamification.badge_list_action" />
<menuitem id="gamification_plan_menu_hr" parent="menu_hr_gamification" action="goal_plan_list_action2" groups="base.group_hr_user"/>
<menuitem id="gamification_goal_menu_hr" parent="menu_hr_gamification" action="goals_menu_groupby_action2" groups="base.group_hr_user"/>
</data>
</openerp>

View File

@ -0,0 +1,5 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
plan_officer,"Goal Plan Officer",gamification.model_gamification_goal_plan,base.group_hr_user,1,1,1,1
planline_officer,"Goal Planline Officer",gamification.model_gamification_goal_planline,base.group_hr_user,1,1,1,1
badge_officer,"Badge Officer",gamification.model_gamification_badge,base.group_hr_user,1,1,1,1
badge_user_officer,"Badge-user Officer",gamification.model_gamification_badge_user,base.group_hr_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 plan_officer Goal Plan Officer gamification.model_gamification_goal_plan base.group_hr_user 1 1 1 1
3 planline_officer Goal Planline Officer gamification.model_gamification_goal_planline base.group_hr_user 1 1 1 1
4 badge_officer Badge Officer gamification.model_gamification_badge base.group_hr_user 1 1 1 1
5 badge_user_officer Badge-user Officer gamification.model_gamification_badge_user base.group_hr_user 1 1 1 1

View File

@ -1,13 +1,7 @@
openerp.hr_gamification = function(instance) {
instance.web_kanban.KanbanRecord.include({
on_card_clicked: function() {
if (this.view.dataset.model === 'gamification.badge') {
if (this.record.stat_count.raw_value > 0) {
this.$('.oe_kanban_badge_avatars a').first().click();
} else {
return false;
}
} else if (this.view.dataset.model === 'gamification.badge.user') {
if (this.view.dataset.model === 'gamification.badge.user') {
var action = {
type: 'ir.actions.act_window',
res_model: 'gamification.badge',