Skip to content

Commit

Permalink
[IMP] hr_recruitment: add support of activities
Browse files Browse the repository at this point in the history
hr.applicant model now supports activities. Filters have been added to ease
their management.
  • Loading branch information
Ravi Gadhia authored and tde-banana-odoo committed Dec 21, 2016
1 parent 87e4571 commit aeda5d5
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 48 deletions.
4 changes: 3 additions & 1 deletion addons/hr_recruitment/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
'views/hr_job_views.xml',
'views/tour_views.xml',
],
'demo': ['data/hr_recruitment_demo.xml'],
'demo': [
'data/hr_recruitment_demo.xml',
],
'test': ['test/recruitment_process.yml'],
'installable': True,
'auto_install': False,
Expand Down
40 changes: 22 additions & 18 deletions addons/hr_recruitment/data/hr_recruitment_demo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@
<field name="partner_name">Enrique Jones</field>
<field name="partner_mobile">9963214587</field>
<field name="stage_id" ref="stage_job1"/>
<field eval="time.strftime('%Y-%m-15 18:15:00')" name="date_action"/>
<field name="title_action">Send mail regarding our interview</field>
</record>
<record id="hr_case_traineemca0" model="hr.applicant">
<field name="name">Trainee - MCA</field>
Expand All @@ -73,8 +71,6 @@
<field name="partner_mobile">9988774455</field>
<field name="stage_id" ref="stage_job4"/>
<field name="partner_phone">6633225</field>
<field eval="time.strftime('%Y-%m-10 18:15:00')" name="date_action"/>
<field name="title_action">Call to define real needs about training</field>
</record>
<record id="hr_case_fresher0" model="hr.applicant">
<field name="name">Fresher</field>
Expand All @@ -87,8 +83,6 @@
<field name="partner_name">Jose</field>
<field name="stage_id" ref="stage_job3"/>
<field name="partner_phone">999666735</field>
<field eval="time.strftime('%Y-%m-5 18:15:00')" name="date_action"/>
<field name="title_action">Send mail regarding our interview</field>
</record>
<record id="hr_case_yrsexperienceinphp0" model="hr.applicant">
<field name="name">Marketing Job</field>
Expand All @@ -99,8 +93,6 @@
<field name="user_id" ref="base.user_root"/>
<field name="partner_name">John Bruno</field>
<field name="stage_id" ref="stage_job5"/>
<field eval="time.strftime('%Y-%m-24 18:15:00')" name="date_action"/>
<field name="title_action">Call to define real needs about training</field>
</record>
<record id="hr_case_marketingjob0" model="hr.applicant">
<field name="name">More than 5 yrs Experience in PHP</field>
Expand All @@ -111,8 +103,6 @@
<field name="user_id" ref="base.user_demo"/>
<field name="partner_name">Sandra Elvis</field>
<field name="stage_id" ref="stage_job5"/>
<field eval="time.strftime('%Y-%m-20 18:15:00')" name="date_action"/>
<field name="title_action">Send mail regarding our interview</field>
</record>
<record id="hr_case_financejob0" model="hr.applicant">
<field name="name">Finance Manager</field>
Expand All @@ -125,8 +115,6 @@
<field name="partner_name">David Armstrong</field>
<field name="stage_id" ref="stage_job2"/>
<field name="partner_phone">33968745</field>
<field eval="time.strftime('%Y-%m-18 18:15:00')" name="date_action"/>
<field name="title_action">Send mail regarding our interview</field>
</record>
<record id="hr_case_traineemca1" model="hr.applicant">
<field name="name">Trainee - MCA</field>
Expand All @@ -138,8 +126,6 @@
<field name="partner_mobile">9898745745</field>
<field name="stage_id" ref="stage_job4"/>
<field name="partner_phone">6630125</field>
<field eval="time.strftime('%Y-%m-15 18:15:00')" name="date_action"/>
<field name="title_action">Send mail regarding our interview</field>
</record>
<record id="hr_case_programmer" model="hr.applicant">
<field name="name">Programmer</field>
Expand All @@ -152,8 +138,6 @@
<field name="stage_id" ref="stage_job4"/>
<field name="partner_phone">6630125</field>
<field name="salary_expected">11000.0</field>
<field eval="time.strftime('%Y-%m-24 18:15:00')" name="date_action"/>
<field name="title_action">Send mail regarding our interview</field>
</record>
<record id="hr_case_advertisement" model="hr.applicant">
<field name="name">Advertisement</field>
Expand All @@ -165,8 +149,6 @@
<field name="partner_mobile">9988774455</field>
<field name="stage_id" ref="stage_job2"/>
<field name="salary_expected">11000.0</field>
<field eval="time.strftime('%Y-%m-15 18:15:00')" name="date_action"/>
<field name="title_action">Send mail regarding our interview</field>
</record>

<record id="hr_case_salesman0_cv" model="ir.attachment">
Expand Down Expand Up @@ -235,5 +217,27 @@
<field name="author_id" ref="base.partner_demo"/>
</record>

<record id="mail_activity_0" model="mail.activity">
<field name="res_id" ref="hr_recruitment.hr_case_salesman0" />
<field name="res_model_id" ref="model_hr_applicant"/>
<field name="activity_type_id" ref="mail.mail_activity_data_email" />
<field name="date_deadline" eval="time.strftime('%Y-%m-15 18:15:00')"/>
<field name="summary">Send mail regarding our interview</field>
</record>
<record id="mail_activity_1" model="mail.activity">
<field name="res_id" ref="hr_recruitment.hr_case_traineemca0" />
<field name="res_model_id" ref="model_hr_applicant"/>
<field name="activity_type_id" ref="mail.mail_activity_data_call" />
<field name="date_deadline" eval="time.strftime('%Y-%m-10 18:15:00')"/>
<field name="summary">Call to define real needs about training</field>
</record>
<record id="mail_activity_2" model="mail.activity">
<field name="res_id" ref="hr_recruitment.hr_case_yrsexperienceinphp0" />
<field name="res_model_id" ref="model_hr_applicant"/>
<field name="activity_type_id" ref="mail.mail_activity_data_call" />
<field name="date_deadline" eval="time.strftime('%Y-%m-24 18:15:00')"/>
<field name="summary">Call to define real needs about training</field>
</record>

</data>
</odoo>
4 changes: 1 addition & 3 deletions addons/hr_recruitment/models/hr_recruitment.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class Applicant(models.Model):
_name = "hr.applicant"
_description = "Applicant"
_order = "priority desc, id desc"
_inherit = ['mail.thread', 'utm.mixin']
_inherit = ['mail.thread', 'mail.activity.mixin', 'utm.mixin']
_mail_mass_mailing = _('Applicants')

def _default_stage_id(self):
Expand Down Expand Up @@ -135,8 +135,6 @@ def _default_company_id(self):
date_closed = fields.Datetime("Closed", readonly=True, index=True)
date_open = fields.Datetime("Assigned", readonly=True, index=True)
date_last_stage_update = fields.Datetime("Last Stage Update", index=True, default=fields.Datetime.now)
date_action = fields.Date("Next Action Date")
title_action = fields.Char("Next Action", size=64)
priority = fields.Selection(AVAILABLE_PRIORITIES, "Appreciation", default='0')
job_id = fields.Many2one('hr.job', "Applied Job")
salary_proposed_extra = fields.Char("Proposed Salary Extra", help="Salary Proposed by the Organisation, extra advantages")
Expand Down
93 changes: 67 additions & 26 deletions addons/hr_recruitment/views/hr_recruitment_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
<field name="partner_phone"/>
<field name="job_id"/>
<field name="stage_id"/>
<field name="title_action" invisible="context.get('invisible_next_action', True)"/>
<field name="date_action" invisible="context.get('invisible_next_date', True)"/>
<field name="medium_id"/>
<field name="source_id"/>
<field name="priority"/>
Expand All @@ -49,6 +47,21 @@
</field>
</record>

<record id="hr_applicant_view_tree_activity" model="ir.ui.view">
<field name="name">hr.applicant.view.tree.activity</field>
<field name="model">hr.applicant</field>
<field name="arch" type="xml">
<tree string="Next Activities" decoration-danger="activity_date_deadline &lt; current_date" default_order="activity_date_deadline">
<field name="name"/>
<field name="partner_id"/>
<field name="activity_date_deadline"/>
<field name="activity_type_id"/>
<field name="activity_summary"/>
<field name="stage_id"/>
</tree>
</field>
</record>

<record model="ir.ui.view" id="crm_case_form_view_job">
<field name="name">Jobs - Recruitment Form</field>
<field name="model">hr.applicant</field>
Expand Down Expand Up @@ -113,11 +126,6 @@
</group>
<group>
<field name="user_id"/>
<label for="title_action"/>
<div>
<field name="date_action"/>
<field name="title_action" class="oe_inline" placeholder="e.g. Call for interview"/>
</div>
<field name="priority" widget="priority"/>
<field name="medium_id" groups="base.group_no_one" />
<field name="source_id"/>
Expand Down Expand Up @@ -150,6 +158,7 @@
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="activity_ids" widget="mail_activity"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</form>
Expand Down Expand Up @@ -178,24 +187,31 @@
</record>

<record id="view_crm_case_jobs_filter" model="ir.ui.view">
<field name="name">Jobs - Recruitment Search</field>
<field name="name">hr.applicant.view.search</field>
<field name="model">hr.applicant</field>
<field name="arch" type="xml">
<search string="Search Applicants">
<field name="partner_name" filter_domain="['|','|',('name','ilike',self),('partner_name','ilike',self),('email_from','ilike',self)]" string="Subject / Applicant"/>
<filter string="My" domain="[('user_id', '=', uid)]"/>
<filter string="My Applications" domain="[('user_id', '=', uid)]"/>
<filter string="Unassigned" domain="[('user_id', '=', False)]"/>
<separator/>
<filter string="Next Actions" context="{'invisible_next_action':False, 'invisible_next_date':False}"
domain="[('date_action','&lt;&gt;',False)]" help="Filter and view on next actions and date"/>
<separator/>
<filter string="Unread Messages" name="message_needaction" domain="[('message_needaction','=',True)]"/>
<filter string="Archived" name="inactive" domain="[('active','=',False)]"/>
<field name="job_id"/>
<field name="department_id"/>
<field name="user_id"/>
<field name="stage_id" domain="[]"/>
<separator/>
<filter string="My Activities" name="activities_my"
domain="[('activity_ids.user_id', '=', uid)]"/>
<filter string="Today Activities" name="activities_today"
domain="[('activity_ids.date_deadline', '=', context_today().strftime('%Y-%m-%d'))]"/>
<filter string="Upcoming Activities (7 days)" name="activities_week"
domain="['&amp;', ('activity_ids.date_deadline', '&gt;=', context_today().strftime('%Y-%m-%d')),
('activity_ids.date_deadline', '&lt;=', (context_today()+datetime.timedelta(days=7)).strftime('%Y-%m-%d'))
]"/>
<filter string="Overdue Activities" name="activities_overdue"
domain="[('activity_ids.date_deadline', '&lt;', context_today().strftime('%Y-%m-%d'))]"
help="Show all records which has next action date is before today"/>
<field name="categ_ids"/>
<field name="attachment_ids" filter_domain="[('attachment_ids.index_content', 'ilike', self)]" string="Attachments"/>
<separator/>
Expand All @@ -211,17 +227,15 @@
</field>
</record>

<!-- CRM Lead Calendar View -->
<record model="ir.ui.view" id="hr_applicant_calendar_view">
<field name="name">Hr Applicants Calendar</field>
<field name="model">hr.applicant</field>
<field name="priority" eval="2"/>
<field name="arch" type="xml">
<calendar string="Applicants"
date_start="date_action" color="user_id">
<calendar string="Applicants" date_start="activity_date_deadline" color="user_id">
<field name="name"/>
<field name="partner_name"/>
<field name="title_action"/>
<field name="activity_summary"/>
</calendar>
</field>
</record>
Expand All @@ -240,12 +254,13 @@
<field name="partner_name"/>
<field name="type_id"/>
<field name="job_id"/>
<field name="title_action"/>
<field name="department_id"/>
<field name="categ_ids"/>
<field name="message_needaction_counter"/>
<field name="attachment_number"/>
<field name="active"/>
<field name="activity_ids" />
<field name="activity_state" />
<templates>
<t t-name="kanban-tooltip">
<ul class="oe_kanban_tooltip">
Expand Down Expand Up @@ -273,13 +288,12 @@
<i><field name="name"/></i><br/>
<field name="job_id"/><br/>
<t t-if="record.partner_mobile.raw_value">Mobile: <field name="partner_mobile"/><br/></t>
<t t-if="record.date_action.raw_value and record.date_action.raw_value lt (new Date())" t-set="red">oe_kanban_text_red</t>
<span t-attf-class="#{red || ''}"><field name="date_action"/></span>
<t t-if="record.date_action.raw_value"> : </t>
<field name="title_action"/>
<div class="oe_kanban_bottom_right">
<div class="o_kanban_inline_block ml4">
<field name="activity_ids" widget="kanban_activity"/>
</div>
<img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" width="24" height="24" class="oe_kanban_avatar pull-right"/>
<div class="pull-left" groups="base.group_user">
<div class="pull-left mt4" groups="base.group_user">
<field name="priority" widget="priority"/>
</div>
</div>
Expand Down Expand Up @@ -316,6 +330,22 @@
</p>
</field>
</record>

<record id="hr_applicant_action_activity" model="ir.actions.act_window">
<field name="name">My Next Activities</field>
<field name="res_model">hr.applicant</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,kanban,calendar</field>
<field name="view_id" ref="hr_applicant_view_tree_activity"/>
<field name="context">{'search_default_activities_my': 1}</field>
<field name="domain">[('activity_date_deadline', '!=', False)]</field>
<field name="help" type="html">
<p>
Currently there are not any activity scheduled.
</p>
</field>
</record>

<record model="ir.actions.act_window" id="action_hr_job_sources">
<field name="name">Jobs Sources</field>
<field name="res_model">hr.recruitment.source</field>
Expand Down Expand Up @@ -499,7 +529,7 @@
process and follow up all operations: meetings, interviews, etc.
</p><p>
Applicants and their attached CV are created automatically when an email is sent.
If you install the document management modules, all resumes are indexed automatically,
If you install the document management modules, all resumes are indexed automatically,
so that you can easily search through their content.
</p>
</field>
Expand All @@ -526,7 +556,7 @@
<field name="act_window_id" ref="crm_case_categ0_act_job"/>
</record>

<record model="ir.actions.act_window.view" id="action_hr_sec_graph_view_act_job">
<record id="action_hr_sec_graph_view_act_job" model="ir.actions.act_window.view">
<field name="sequence" eval="4"/>
<field name="view_mode">graph</field>
<field name="view_id" ref="crm_case_graph_view_job"/>
Expand All @@ -549,7 +579,18 @@
<menuitem
name="Applications"
parent="menu_hr_recruitment_root"
id="menu_crm_case_categ0_act_job" action="crm_case_categ0_act_job" sequence="2" groups="base.group_no_one"/>
id="menu_crm_case_categ0_act_job" sequence="2"/>

<menuitem
name="All Applications"
parent="menu_crm_case_categ0_act_job"
id="menu_crm_case_categ_all_app" action="crm_case_categ0_act_job" sequence="2"/>

<menuitem id="hr_applicant_nmenu_activity"
name="Next Activities"
parent="hr_recruitment.menu_crm_case_categ0_act_job"
action="hr_applicant_action_activity"
sequence="20"/>

<!-- Resume and Letters -->
<record id="ir_attachment_view_search_inherit_hr_recruitment" model="ir.ui.view">
Expand Down

0 comments on commit aeda5d5

Please sign in to comment.