diff options
| author | dka-odoo <dka@openerp.com> | 2015-01-20 13:53:07 +0100 |
|---|---|---|
| committer | Jérome Maes <jem@openerp.com> | 2015-02-25 11:25:40 +0100 |
| commit | d27910a8f2f2b29810dfa8022ad748cce64df00a (patch) | |
| tree | 52776525b58ddb4d4c1b01ac63f2d0ac9e411b99 /addons/hr_evaluation | |
| parent | e5875acc6aa19ca0a41ea1b4be9081bfd674005e (diff) | |
[IMP] hr_department: new kanban view for HR Departments.
hr add a simple kanban view that is updated by the various hr modules.
Each module adds statistics and links in the kanban vignette, either
in a to do or to approve column.
The department kanban view can be seen as a small dashboard to have
the main data about the department displayed. Links allow the HR
manager to be redirected towards the various things to do or to
approve in its department.
Diffstat (limited to 'addons/hr_evaluation')
| -rw-r--r-- | addons/hr_evaluation/__init__.py | 1 | ||||
| -rw-r--r-- | addons/hr_evaluation/hr_department.py | 29 | ||||
| -rw-r--r-- | addons/hr_evaluation/hr_evaluation_view.xml | 54 |
3 files changed, 83 insertions, 1 deletions
diff --git a/addons/hr_evaluation/__init__.py b/addons/hr_evaluation/__init__.py index c98e428757a..0be2db9fc23 100644 --- a/addons/hr_evaluation/__init__.py +++ b/addons/hr_evaluation/__init__.py @@ -19,5 +19,6 @@ # ############################################################################## +import hr_department import hr_evaluation import report diff --git a/addons/hr_evaluation/hr_department.py b/addons/hr_evaluation/hr_department.py new file mode 100644 index 00000000000..2f0783ee029 --- /dev/null +++ b/addons/hr_evaluation/hr_department.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +from openerp import api, fields, models + + +class hr_department(models.Model): + _inherit = 'hr.department' + + @api.multi + def _compute_interview_request(self): + Interview = self.env['hr.evaluation.interview'] + for department in self: + department.interview_request_count = Interview.search_count([ + ('user_to_review_id.department_id', '=', department.id), + ('state', '=', 'waiting_answer') + ]) + + @api.multi + def _compute_appraisal_to_start(self): + Evaluation = self.env['hr_evaluation.evaluation'] + for department in self: + department.appraisal_to_start_count = Evaluation.search_count([ + ('employee_id.department_id', '=', department.id), + ('state', '=', 'draft') + ]) + + appraisal_to_start_count = fields.Integer( + compute='_compute_appraisal_to_start', string='Appraisal to Start') + interview_request_count = fields.Integer( + compute='_compute_interview_request', string='Interview Request') diff --git a/addons/hr_evaluation/hr_evaluation_view.xml b/addons/hr_evaluation/hr_evaluation_view.xml index b91af7b4653..da24b8b914c 100644 --- a/addons/hr_evaluation/hr_evaluation_view.xml +++ b/addons/hr_evaluation/hr_evaluation_view.xml @@ -147,7 +147,7 @@ </group> </xpath> <xpath expr="//div[@name='button_box']" position="inside"> - <button name="%(act_hr_employee_2_hr__evaluation_interview)d" + <button name="%(act_hr_employee_2_hr__evaluation_interview)d" class="oe_stat_button" icon="fa-sitemap" type="action"> @@ -227,6 +227,7 @@ <field name="date"/> <field name="employee_id"/> <field name="plan_id"/> + <field name="state"/> <filter icon="terp-check" string="Pending" domain="[('state','=','wait')]" help="Appraisal that are in Plan In Progress state"/> <filter icon="terp-camera_test" string="In progress" domain="[('state','=','progress')]" help="Appraisal that are in waiting appreciation state"/> <separator/> @@ -337,6 +338,7 @@ <field name="user_to_review_id"/> <field name="user_id" string="Interviewer"/> <field name="deadline"/> + <field name="state"/> <filter icon="terp-gtk-go-back-rtl" string="To Do" name="todo" domain="[('state','=','waiting_answer')]"/> <separator/> <filter string="New Mail" name="message_unread" domain="[('message_unread','=',True)]"/> @@ -413,5 +415,55 @@ 'default_body': 'Hello,\n\nKindly post your response for the survey interview.\n\nThanks', 'default_subject': 'Reminder to fill up Survey'}"/> + <record id="hr_evaluation_interview_action_from_department" model="ir.actions.act_window"> + <field name="name">Interview Requests</field> + <field name="res_model">hr.evaluation.interview</field> + <field name="view_type">form</field> + <field name="view_id" eval="False"/> + <field name="context">{'search_default_state': 'waiting_answer'}</field> + <field name="domain">[('user_to_review_id.department_id', '=', active_id)]</field> + <field name="search_view_id" ref="view_hr_evaluation_interview_search"/> + </record> + + <record id="hr_appraisal_action_from_department" model="ir.actions.act_window"> + <field name="name">Appraisal to start</field> + <field name="res_model">hr_evaluation.evaluation</field> + <field name="view_type">form</field> + <field name="view_mode">tree,form</field> + <field name="search_view_id" ref="hr_evaluation.evaluation_search"/> + <field name="context">{'search_default_state': 'draft'}</field> + <field name="domain">[('employee_id.department_id', '=', active_id)]</field> + </record> + + <!--Hr Department Inherit Kanban view--> + <record id="hr_department_view_kanban" model="ir.ui.view"> + <field name="name">hr.department.kanban.inherit</field> + <field name="model">hr.department</field> + <field name="inherit_id" ref="hr.hr_department_view_kanban"/> + <field name="arch" type="xml"> + <data> + <xpath expr="//templates" position="before"> + <field name="appraisal_to_start_count"/> + <field name="interview_request_count"/> + </xpath> + <xpath expr="//div[@name='to_do']" position="attributes"> + <attribute name="class">col-md-6 col-xs-6</attribute> + </xpath> + <xpath expr="//div[@name='to_do']" position="inside"> + <div> + <a name="%(hr_evaluation_interview_action_from_department)d" type="action"> + <t t-esc="record.interview_request_count.raw_value or 0"/> Interview Requests + </a> + </div> + <div> + <a name="%(hr_appraisal_action_from_department)d" type="action"> + <t t-esc="record.appraisal_to_start_count.raw_value or 0"/> Appraisal to Start + </a> + </div> + </xpath> + </data> + </field> + </record> + </data> </openerp> |
