forked from osbzr/gooderp_addons
-
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.
- Loading branch information
Showing
9 changed files
with
1,568 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from . import models |
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,27 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2018 上海开阖软件 ((http:www.osbzr.com).) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
'name': 'GOODERP 招聘', | ||
'version': '11.11', | ||
'author': '上海开阖软件', | ||
'maintainer': 'False', | ||
'website': 'http://www.osbzr.com', | ||
'category': 'gooderp', | ||
'summary': '员工招聘,工作申请,求职', | ||
'description': """管理招聘流程""", | ||
'depends': [ | ||
'staff', | ||
], | ||
# always loaded | ||
'data': [ | ||
'views/hire_view.xml', | ||
'views/staff_job_view.xml', | ||
], | ||
# only loaded in demonstration mode | ||
'demo': [ | ||
], | ||
'installable': True, | ||
'application': False, | ||
} |
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,6 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from . import staff_hire | ||
from . import staff | ||
from . import staff_department | ||
from . import staff_job |
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,39 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class staff(models.Model): | ||
_inherit = "staff" | ||
|
||
newly_hired_staff = fields.Boolean(u'新进员工', compute='_compute_newly_hired_staff', | ||
search='_search_newly_hired_staff') | ||
|
||
@api.multi | ||
def _compute_newly_hired_staff(self): | ||
read_group_result = self.env['hr.applicant'].read_group( | ||
[('emp_id', 'in', self.ids), ('job_id.state', '=', 'recruit')], | ||
['emp_id'], ['emp_id']) | ||
result = dict((data['emp_id'], data['emp_id_count'] > 0) for data in read_group_result) | ||
for record in self: | ||
record.newly_hired_staff = result.get(record.id, False) | ||
|
||
def _search_newly_hired_staff(self, operator, value): | ||
applicants = self.env['hr.applicant'].search([('job_id.state', '=', 'recruit')]) | ||
return [('id', 'in', applicants.ids)] | ||
|
||
# @api.multi | ||
# def _broadcast_welcome(self): | ||
# """ Broadcast the welcome message to all users in the employee company. """ | ||
# self.ensure_one() | ||
# IrModelData = self.env['ir.model.data'] | ||
# channel_all_employees = IrModelData.xmlid_to_object('mail.channel_all_employees') | ||
# template_new_employee = IrModelData.xmlid_to_object('hr_recruitment.email_template_data_applicant_employee') | ||
# if template_new_employee: | ||
# MailTemplate = self.env['mail.template'] | ||
# body_html = MailTemplate.render_template(template_new_employee.body_html, 'hr.employee', self.id) | ||
# subject = MailTemplate.render_template(template_new_employee.subject, 'hr.employee', self.id) | ||
# channel_all_employees.message_post( | ||
# body=body_html, subject=subject, | ||
# subtype='mail.mt_comment') | ||
# return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class staff_department(models.Model): | ||
_inherit = 'staff.department' | ||
|
||
new_applicant_count = fields.Integer( | ||
compute='_compute_new_applicant_count', string='New Applicant') | ||
new_hired_employee = fields.Integer( | ||
compute='_compute_recruitment_stats', string='New Hired Employee') | ||
expected_employee = fields.Integer( | ||
compute='_compute_recruitment_stats', string='Expected Employee') | ||
|
||
@api.multi | ||
def _compute_new_applicant_count(self): | ||
applicant_data = self.env['hr.applicant'].read_group( | ||
[('department_id', 'in', self.ids), ('stage_id.sequence', '<=', '1')], | ||
['department_id'], ['department_id']) | ||
result = dict((data['department_id'][0], data['department_id_count']) for data in applicant_data) | ||
for department in self: | ||
department.new_applicant_count = result.get(department.id, 0) | ||
|
||
@api.multi | ||
def _compute_recruitment_stats(self): | ||
job_data = self.env['staff.job'].read_group( | ||
[('department_id', 'in', self.ids)], | ||
['no_of_hired_employee', 'no_of_recruitment', 'department_id'], ['department_id']) | ||
new_emp = dict((data['department_id'][0], data['no_of_hired_employee']) for data in job_data) | ||
expected_emp = dict((data['department_id'][0], data['no_of_recruitment']) for data in job_data) | ||
for department in self: | ||
department.new_hired_employee = new_emp.get(department.id, 0) | ||
department.expected_employee = expected_emp.get(department.id, 0) |
Oops, something went wrong.