-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] hr: add onboarding/offboarding activity plannings
Purpose ======= Give the possibility to elaborate plans through Odoo. For instance, in HR, you could create an onboarding plan when a employee is created. Someone manages laptop and other equipment, someone check hr stuff, ... This feature is generic but in a first time we will apply it only on the hr module. Ease HR process in a company by creating plans: a plan is an assembly of Next Activities that will be launched together whenever you need it. Example of plan for an employee onboarding: Activity: Prepare materials Responsible: Alain Deadline: At the contract signature Activity: Manage Cars Responsible: Cécile Deadline: at the contract signature (both signature) Activity: Plan Training Responsible: Caroline Deadline: After signature Activity: Training Responsible: Employee Deadline: 1 week after the employement date Specifications ============== On HR Configuration: Add a menu "Activity Plans" Activity plan object: - Name - Model (debug mode) (hr by default) - Activity Template o2m - Activity Type (only the one related to hr) - Deadline (come from Activity Type) - Responsible \/ 0 Coach 0 Manager 0 Other [Responsible_name] \/ (coach, manager or manually set if other) Add datas, 2 plans: Onboarding - Name: Onboarding - Plan lines: Activity: Setup IT Materials Responsible: [a user] (manager) Deadline: At the contract signature Activity: Plan Training Responsible: [manager] Deadline: After signature Activity: Training Responsible: [Employee] Deadline: 1 week after the employement date Offboarding - Name: Onboarding - Plan lines: Activity: Compute Out Delais Responsible: [a user] (manager) Deadline: today Activity: Take Back HR Materials Responsible: [manager] Deadline: today Activity: Manage Car Responsible: [manager] Deadline: today When to trigger it ? HR specific use case: 1/ On employee, from the employee chatter: when you create an employee, Odoobot will log a note with the following message: "Congratulations ! May i recommand you to setup an onboarding plan?", with a link create a plan from it. 2/ Add a button 'launch plan' to open a wizard to select the plan 3/ When archive an employee Open a wizard with: - Reason (selection) - Action plan (m2o not required) Error if employee not linked to a user. Task : 1912681 closes odoo#29151
- Loading branch information
1 parent
e230050
commit d5fd84b
Showing
14 changed files
with
440 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,5 @@ | |
from . import mail_channel | ||
from . import res_partner | ||
from . import res_users | ||
|
||
from . import plan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# -*- coding: utf-8 -*- | ||
# Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
|
||
from odoo import fields, models, _ | ||
from odoo.exceptions import UserError | ||
|
||
|
||
class PlanActivityType(models.Model): | ||
_name = 'hr.plan.activity.type' | ||
_description = 'Plan activity type' | ||
|
||
activity_type_id = fields.Many2one('mail.activity.type', 'Activity Type', | ||
domain=lambda self: [('res_model_id', '=', self.env['ir.model']._get('hr.employee').id)]) | ||
name = fields.Char(related='activity_type_id.name') | ||
responsible = fields.Selection([ | ||
('coach', 'Coach'), | ||
('manager', 'Manager'), | ||
('employee', 'Employee'), | ||
('other', 'Other')], default='employee', string='Responsible') | ||
responsible_id = fields.Many2one('res.users', 'Responsible Person') | ||
|
||
def get_responsible_id(self, employee_id): | ||
if self.responsible == 'coach': | ||
self.responsible_id = employee_id.coach_id.user_id | ||
if not self.responsible_id: | ||
raise UserError(_('No user linked to the coach of %s. Please contact an administrator.') % employee_id.name) | ||
elif self.responsible == 'manager': | ||
self.responsible_id = employee_id.parent_id.user_id | ||
if not self.responsible_id: | ||
raise UserError(_('No user linked to the manager of %s. Please contact an administrator.') % employee_id.name) | ||
elif self.responsible == 'employee': | ||
self.responsible_id = employee_id.user_id | ||
if not self.responsible_id: | ||
raise UserError(_('No user linked to the employee %s. Please contact an administrator.') % employee_id.name) | ||
return self.responsible_id | ||
|
||
|
||
class Plan(models.Model): | ||
_name = 'hr.plan' | ||
_description = 'plan' | ||
|
||
name = fields.Char('Name', required=True) | ||
plan_activity_type_ids = fields.Many2many('hr.plan.activity.type', string='Activities') | ||
active = fields.Boolean(default=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.