diff --git a/addons/gamification/badge_view.xml b/addons/gamification/badge_view.xml index 5d616ba6a42..f86f104e96f 100644 --- a/addons/gamification/badge_view.xml +++ b/addons/gamification/badge_view.xml @@ -103,7 +103,8 @@ - - + diff --git a/addons/hr_evaluation/security/ir.model.access.csv b/addons/hr_evaluation/security/ir.model.access.csv index ffeacde94ca..4be3d74b7d8 100644 --- a/addons/hr_evaluation/security/ir.model.access.csv +++ b/addons/hr_evaluation/security/ir.model.access.csv @@ -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 \ No newline at end of file +access_survey_tbl_column_heading_hr_employee,survey.tbl.column.heading,survey.model_survey_tbl_column_heading,base.group_user,1,1,1,0 \ No newline at end of file diff --git a/addons/hr_gamification/__init__.py b/addons/hr_gamification/__init__.py index 16a4761cb3f..cef4a8c371c 100644 --- a/addons/hr_gamification/__init__.py +++ b/addons/hr_gamification/__init__.py @@ -1 +1 @@ -import badge +import gamification diff --git a/addons/hr_gamification/__openerp__.py b/addons/hr_gamification/__openerp__.py index c28a43fd32a..9b7be7b3ea0 100644 --- a/addons/hr_gamification/__openerp__.py +++ b/addons/hr_gamification/__openerp__.py @@ -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'], } diff --git a/addons/hr_gamification/badge.py b/addons/hr_gamification/gamification.py similarity index 92% rename from addons/hr_gamification/badge.py rename to addons/hr_gamification/gamification.py index e4ccac1cb75..43a9a97f94d 100644 --- a/addons/hr_gamification/badge.py +++ b/addons/hr_gamification/gamification.py @@ -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"), diff --git a/addons/hr_gamification/badge_view.xml b/addons/hr_gamification/gamification_view.xml similarity index 63% rename from addons/hr_gamification/badge_view.xml rename to addons/hr_gamification/gamification_view.xml index fac64711591..59bb0a612b8 100644 --- a/addons/hr_gamification/badge_view.xml +++ b/addons/hr_gamification/gamification_view.xml @@ -23,9 +23,6 @@ - - - Reward Employee Badge Form gamification.badge.user.wizard @@ -86,7 +83,58 @@ + + + + + + + + + + gamification.goal + form + Goals History + tree,kanban + {'search_default_group_by_user': True, 'search_default_group_by_type': True} + [('plan_id.category', '=', 'hr')] + +

+ Click to create a goal. +

+

+ A goal is defined by a user and a goal type. + Goals can be created automatically by using goal plans. +

+
+
+ + + + Challenges + gamification.goal.plan + kanban,tree,form + [('category', '=', 'hr')] + {'search_default_inprogress':True, 'default_inprogress':True} + +

+ Click to create a challenge. +

+

+ 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. +

+
+
+ + + + + + +
diff --git a/addons/hr_gamification/security/ir.model.access.csv b/addons/hr_gamification/security/ir.model.access.csv new file mode 100644 index 00000000000..a2a9cf3010b --- /dev/null +++ b/addons/hr_gamification/security/ir.model.access.csv @@ -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 \ No newline at end of file diff --git a/addons/hr_gamification/static/src/js/badges.js b/addons/hr_gamification/static/src/js/gamification.js similarity index 63% rename from addons/hr_gamification/static/src/js/badges.js rename to addons/hr_gamification/static/src/js/gamification.js index 7506c65f144..a9126464a10 100644 --- a/addons/hr_gamification/static/src/js/badges.js +++ b/addons/hr_gamification/static/src/js/gamification.js @@ -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',