Merge pull request !385 from dev_zhou
This commit is contained in:
李鹏宇
2024-11-06 14:04:00 +00:00
committed by Gitee
12 changed files with 136 additions and 72 deletions
@@ -5,7 +5,7 @@ class HrApplicant(models.Model):
_inherit = "hr.applicant"
_rec_name = 'partner_name'
#基础信息
name = fields.Char(string="标题")
takes_time = fields.Date(string="需要时间")
colleges = fields.Char(string="院校")
degree = fields.Selection([('high', '高中'), ('junior_college', '大专'), ('bachelor', '本科'),
@@ -19,8 +19,6 @@ class HrApplicant(models.Model):
tage_ids = fields.Many2many('applicant.tage.setting', string="应聘标签")
is_interview_status = fields.Boolean(string="面试状态")
class HrJobType(models.Model):
_name = "hr.job.type"
@@ -7,11 +7,6 @@
<field name="arch" type="xml">
<xpath expr="//form[@class='o_applicant_form']" position="replace">
<form class="o_applicant_form">
<div class="col-12 text-center">
<h1>
<field name="name" required="1"/>
</h1>
</div>
<group col="4" string="基本信息">
<group>
<field name="partner_name" required="1" string="姓名"/>
@@ -4,23 +4,6 @@ from odoo.exceptions import UserError
class HrApplicant(models.Model):
_inherit = 'hr.applicant'
interview_approval_id = fields.Many2one('yuthon.interview.approval', string="面试申请表关联")
interview_time = fields.Datetime(string='面试时间')
room_id = fields.Many2one('room.room',string='地点')
interview_stage_id = fields.Many2one('hr.recruitment.stage', string='面试阶段')
tage_ids = fields.Many2many('applicant.tage.setting', string="应聘标签")
employee_ids = fields.Many2many('hr.employee', string='面试官')
def buttn_applicant_ids(self):
self.ensure_one()
return {
'type': 'ir.actions.act_window',
'res_model': 'hr.applicant',
'res_id': self.id,
'view_mode': 'form',
'target': 'current',
}
def pub_interview_approval(self):
for applicant in self:
if not applicant.is_interview_status:
@@ -29,7 +12,12 @@ class HrApplicant(models.Model):
raise UserError(_('该申请已提交,请勿重复提交!'))
hr_applicant_ids = self.env["hr.applicant"].browse(self._context.get('active_ids', self._context.get('active_id')))
hr_applicant_data = [(6, 0, hr_applicant_ids.ids)]
hr_applicant_list = []
for applicant in hr_applicant_ids:
hr_applicant_list.append([0, 0, {
'name': applicant.partner_name,
'stage_id':applicant.stage_id.id,
}])
form_id = self.env.ref("yuthon_hr_employee_approval.view_yuthon_interview_approval_form").id
return {
'type': 'ir.actions.act_window',
@@ -40,11 +28,10 @@ class HrApplicant(models.Model):
'default_name': '面试申请表',
'default_job_id': self.job_id.id,
'default_department_id': self.department_id.id,
'default_applicant_ids': hr_applicant_data
'default_applicant_ids': hr_applicant_list,
}
}
def write(self, vals):
res = super(HrApplicant, self).write(vals)
if 'stage_id' in vals:
@@ -6,7 +6,6 @@ from odoo.exceptions import UserError
class YuthonHrEmployee(models.Model):
_inherit = "hr.employee"
def pub_reassignment_employee(self):
record_id = self.env["hr.employee"].browse(self._context.get('active_ids', self._context.get('active_id')))
if len(record_id) != 1:
@@ -34,12 +34,28 @@ class HrJob(models.Model):
def pub_prepare_approval_button(self):
hr_job_ids = self.env["hr.job"].browse(self._context.get('active_ids', self._context.get('active_id')))
form_id = self.env.ref("yuthon_hr_employee_approval.view_yuthon_prepare_approval_form").id
hr_job_list = []
for job in hr_job_ids:
hr_job_list.append([0, 0, {
'hr_job_id':job.id,
'department_id': job.department_id.id,
'job_type_id': job.job_type_id.id,
'job_lv_id': job.job_lv_id.name,
'yuthon_company': job.yuthon_company,
'establishment_quotas': job.establishment_quotas,
'no_of_employee': job.no_of_employee,
'compiling_external': job.compiling_external,
'missing_number': job.missing_number,
'compiling_status': job.compiling_status,
'job_personnel': job.job_personnel,
'remarks': job.remarks,
}])
return {
'type': 'ir.actions.act_window',
'name': '提交岗位编制调整申请',
'res_model': 'yuthon.prepare.approval',
"views": [[form_id, "form"]],
"context": {
'default_adjust_information_ids': [(6 ,0 , hr_job_ids.ids)],
'default_adjust_information_ids': hr_job_list,
}
}
@@ -9,14 +9,14 @@ class YuthonInterviewApproval(models.Model):
_description = '面试信息表'
_inherit = 'soong.workflow.mixin'
name = fields.Char(string='标题')
job_id = fields.Many2one('hr.job', string='应聘岗位')
department_id = fields.Many2one("hr.department", string="应聘职务", required=True)
department_id = fields.Many2one("hr.department", string="应聘职务")
code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('yuthon_interview_approval_code'))
applicant_ids = fields.One2many('hr.applicant', 'interview_approval_id', string='应聘面试信息')
applicant_ids = fields.One2many('interview.approval.line', 'interview_approval_id', string='应聘面试信息')
is_issues = fields.Boolean(string='是否上会')
company_page = fields.Selection([('tz', '天河投资'), ('wg', '天河物管'), ('lc', '天河粮储')], string="公司")
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'),
('thlc', '天河粮储'), ('tctj', '天投城建')], string="公司")
related_issues_id = fields.Many2one('issue.library', string="关联议题")
def scheduling_of_meetings(self):
@@ -37,6 +37,29 @@ class YuthonInterviewApproval(models.Model):
def put_interview_stage(self):
for rec in self.applicant_ids:
rec.write({
employee_id = self.env['hr.applicant'].search([('partner_name', '=',rec.name)])
employee_id.write({
'stage_id': rec.interview_stage_id.id})
class InterviewApprovalLine(models.Model):
_name = 'interview.approval.line'
_description = '应聘面试信息'
interview_approval_id = fields.Many2one('yuthon.interview.approval', string="面试申请表关联")
name = fields.Char(string='姓名')
stage_id = fields.Many2one('hr.recruitment.stage', string='阶段')
interview_time = fields.Datetime(string='面试时间')
room_id = fields.Many2one('room.room',string='地点')
interview_stage_id = fields.Many2one('hr.recruitment.stage', string='面试阶段')
tage_ids = fields.Many2many('applicant.tage.setting', string="应聘标签")
employee_ids = fields.Many2many('hr.employee', string='面试官')
def buttn_applicant_ids(self):
self.ensure_one()
return {
'type': 'ir.actions.act_window',
'res_model': 'hr.applicant',
'res_id': self.id,
'view_mode': 'form',
'target': 'current',
}
@@ -16,11 +16,9 @@ class YuthonOnboardApproval(models.Model):
_description = "入职申请表"
_inherit = ['soong.workflow.mixin']
name = fields.Char(string='标题',defualt='人事合同')
code = fields.Char(string="编号",
default=lambda self: self.env['ir.sequence'].next_by_code('yuthon_onboard_approval_code'))
onboard_id = fields.Many2one('hr.applicant',string='姓名')
employee_id = fields.Many2one('hr.employee',string='姓名')
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'),
('thlc', '天河粮储'), ('tctj', '天投城建')], string="甲方")
grades_id = fields.Many2one('yuthon.job.lv', string='职级')
@@ -37,9 +35,23 @@ class YuthonOnboardApproval(models.Model):
documents_ids = fields.Many2many('documents.document', string="附件")
details_personal_information_form_id = fields.Many2one('yuthon.message.login', string="个人信息表详情")
details_recruitment_needs_form_id = fields.Many2one('yuthon.recruitment.approval', string="招聘需求详情")
details_interview_form_id = fields.Many2one('yuthon.interview.approval', string="面试详情")
details_interview_form_id = fields.Many2many('yuthon.interview.approval', string="面试详情")
is_issues = fields.Boolean(string='是否上会')
related_issues_id = fields.Many2one('issue.library', string="关联议题")
# 合同
contract_code = fields.Char(string='合同编号')
contracted_status = fields.Selection([('first', '首签'), ('renew', '续签')], string='合同状态')
def put_contract(self):
form_id = self.env.ref('hr_contract.hr_contract_view_form').id
return {
'name': '合同',
'type': 'ir.actions.act_window',
'res_model': 'hr.contract',
"views": [[form_id, "form"]],
'view_mode': 'form',
'context': {
'default_employee_id': self.employee_id.id,
'default_date_start': self.duration_employment,
'default_date_end': self.duration_employment_end,
'default_job_lv_id': self.grades_id.id,
}}
@@ -17,8 +17,8 @@ class YuthonPrepareApproval(models.Model):
is_issues = fields.Boolean(string='是否上会')
related_issues_id = fields.Many2one('issue.library', string="关联议题")
notice_documents_ids = fields.Many2many('ir.attachment', string='议题附件')
adjust_information_ids = fields.One2many('hr.job', 'prepare_approval_id', string="关联调整信息")
prepare_approval_line_ids = fields.One2many('yuthon.prepare.approval.line', 'prepare_approval_id', string="关联编制调整需求表行")
adjust_information_ids = fields.One2many('prepare.approval.line', 'prepare_approval_id', string="关联调整信息")
prepare_approval_line_ids = fields.One2many('new.prepare.approval.line', 'prepare_approval_id', string="关联编制调整需求表行")
@api.onchange('adjust_information_ids')
def onchange_change_index_library_ids(self):
@@ -26,12 +26,12 @@ class YuthonPrepareApproval(models.Model):
for old in self:
for new in old.adjust_information_ids:
new_lines.append((0, 0, {
'name': new.name,
'department_id': new.department_id,
'hr_job_id': new.hr_job_id.id,
'department_id': new.department_id.id,
'yuthon_company': new.yuthon_company,
'job_type_id': new.job_type_id,
'job_type_id': new.job_type_id.id,
'compiling_external': new.compiling_external,
'job_lv_id': new.job_lv_id,
'job_lv_id': new.job_lv_id.id,
'establishment_quotas': new.establishment_quotas,
'no_of_employee': new.no_of_employee,
'missing_number': new.missing_number,
@@ -44,9 +44,8 @@ class YuthonPrepareApproval(models.Model):
def put_adjustment_approval(self):
self.ensure_one()
for prepare, adjust in zip(self.prepare_approval_line_ids, self.adjust_information_ids):
adjust.write({
'name': prepare.name,
for prepare in self.prepare_approval_line_ids:
prepare.hr_job_id.write({
'department_id': prepare.department_id.id,
'yuthon_company': prepare.yuthon_company,
'job_type_id': prepare.job_type_id.id,
@@ -60,14 +59,56 @@ class YuthonPrepareApproval(models.Model):
'remarks': prepare.remarks,
})
class PrepareApprovalLine(models.Model):
_name = 'yuthon.prepare.approval.line'
_name = 'prepare.approval.line'
_description = '编制调整需求表行'
_inherit = 'soong.workflow.mixin'
prepare_approval_id = fields.Many2one('yuthon.prepare.approval', string="编制调整需求表")
hr_job_id = fields.Many2one('hr.job',string='工作岗位')
department_id = fields.Many2one("hr.department", string="部门")
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'),
('thlc', '天河粮储'), ('tctj', '天投城建')], string="所属公司")
job_type_id = fields.Many2one('hr.job.type', string="岗位类型")
compiling_external = fields.Integer(string="编制外人数")
job_lv_id = fields.Many2one('yuthon.job.lv', string="职级")
establishment_quotas = fields.Integer(string="编制人数")
no_of_employee = fields.Integer(string="当前员工数量")
missing_number = fields.Integer(string="缺编人数",compute='_compute_missing_number')
compiling_status = fields.Selection([('1', '缺编'), ('2', '满编')], compute="_compute_compiling_status", string="状态")
job_personnel = fields.Char(string="在岗人员", compute='_compute_job_personnel')
remarks = fields.Text(string="备注")
@api.depends('establishment_quotas', 'no_of_employee')
def _compute_missing_number(self):
for rec in self:
if rec.establishment_quotas <= rec.no_of_employee:
rec.missing_number = 0
else:
rec.missing_number = abs(rec.establishment_quotas - rec.no_of_employee)
@api.depends('no_of_employee')
def _compute_job_personnel(self):
for rec in self:
employee_ids = rec.env['hr.employee'].search([('job_id', '=', rec.id)])
employee_list = [rec.name for rec in employee_ids]
rec.job_personnel = ','.join(employee_list)
@api.depends('establishment_quotas', 'no_of_employee')
def _compute_compiling_status(self):
for state in self:
if state.missing_number > 0:
state.compiling_status = '1'
else:
state.compiling_status = '2'
class NewPrepareApprovalLine(models.Model):
_name = 'new.prepare.approval.line'
_description = '新编制调整需求表行'
_inherit = 'soong.workflow.mixin'
prepare_approval_id = fields.Many2one('yuthon.prepare.approval', string="编制调整需求表")
name = fields.Char(string='工作岗位')
hr_job_id = fields.Many2one('hr.job', string='工作岗位')
department_id = fields.Many2one("hr.department", string="部门")
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'),
('thlc', '天河粮储'), ('tctj', '天投城建')], string="所属公司")
@@ -29,4 +29,6 @@ access_certificates_detail_line,certificates_detail_line,model_certificates_deta
access_yuthon_transfer_approval,yuthon_transfer_approval,model_yuthon_transfer_approval,base.group_user,1,1,1,1
access_yuthon_transfer_infor_detail_lines,yuthon_transfer_infor_detail_lines,model_yuthon_transfer_infor_detail_lines,base.group_user,1,1,1,1
access_yuthon_social_files_approval,yuthon_social_files_approval,model_yuthon_social_files_approval,base.group_user,1,1,1,1
access_yuthon_prepare_approval_line,yuthon_prepare_approval_line,model_yuthon_prepare_approval_line,base.group_user,1,1,1,1
access_new_prepare_approval_line,new_prepare_approval_line,model_new_prepare_approval_line,base.group_user,1,1,1,1
access_interview_approval_line,interview_approval_line,model_interview_approval_line,base.group_user,1,1,1,1
access_prepare_approval_line,prepare_approval_line,model_prepare_approval_line,base.group_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
29 access_yuthon_transfer_approval yuthon_transfer_approval model_yuthon_transfer_approval base.group_user 1 1 1 1
30 access_yuthon_transfer_infor_detail_lines yuthon_transfer_infor_detail_lines model_yuthon_transfer_infor_detail_lines base.group_user 1 1 1 1
31 access_yuthon_social_files_approval yuthon_social_files_approval model_yuthon_social_files_approval base.group_user 1 1 1 1
32 access_yuthon_prepare_approval_line access_new_prepare_approval_line yuthon_prepare_approval_line new_prepare_approval_line model_yuthon_prepare_approval_line model_new_prepare_approval_line base.group_user 1 1 1 1
33 access_interview_approval_line interview_approval_line model_interview_approval_line base.group_user 1 1 1 1
34 access_prepare_approval_line prepare_approval_line model_prepare_approval_line base.group_user 1 1 1 1
@@ -31,7 +31,7 @@
</group>
<group>
<field name="code"/>
<field name="company_page"/>
<field name="yuthon_company" invisible="1"/>
<field name="is_issues" invisible="1"/>
</group>
</group>
@@ -39,13 +39,9 @@
<page string="应聘面试信息">
<field name="applicant_ids">
<tree editable="bottom">
<field name="company_id" column_invisible="1"/>
<field name="job_id" column_invisible="1"/>
<field name="name" string="岗位" column_invisible="1"/>
<field name="partner_name" string="姓名" readonly="1"/>
<field name="stage_id" readonly="1" />
<field name="name" string="姓名"/>
<field name="stage_id"/>
<field name="interview_time"/>
<field name="room_id"/>
<field name="tage_ids" widget="many2many_tags"/>
<field name="employee_ids" widget="many2many_tags"/>
<field name="interview_stage_id"/>
@@ -5,7 +5,6 @@
<field name="model">yuthon.onboard.approval</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="code"/>
<field name="yuthon_company"/>
<field name="onboard_time"/>
@@ -18,14 +17,11 @@
<field name="arch" type="xml">
<form>
<sheet>
<div class="col-12 text-center">
<h1>
<field name="name" required="1"/>
</h1>
</div>
<header>
<button name="put_contract" type="object" class="oe_highlight" string="合同"/>
</header>
<group col="2">
<group>
<field name="contract_code"/>
<field name="yuthon_company"/>
</group>
<group>
@@ -35,7 +31,7 @@
</group>
<group col="4" string="乙方信息">
<group>
<field name="onboard_id" required="1"/>
<field name="employee_id" required="1"/>
<field name="documents_ids" widget="many2many_tags"/>
</group>
<group>
@@ -74,7 +70,7 @@
<group>
<field name="details_personal_information_form_id"/>
<field name="details_recruitment_needs_form_id"/>
<field name="details_interview_form_id"/>
<field name="details_interview_form_id" widget="many2many_tags"/>
</group>
<group>
</group>
@@ -42,12 +42,11 @@
<group/>
<field name="adjust_information_ids" string=" ">
<tree editable="bottom" create="false" delete="false">
<field name="name"/>
<field name="hr_job_id"/>
<field name="prepare_approval_id" column_invisible="1"/>
<field name="department_id"/>
<field name="job_type_id"/>
<field name="job_lv_id"/>
<field name="company_id" column_invisible="1"/>
<field name="yuthon_company"/>
<field name="establishment_quotas"/>
<field name="no_of_employee"/>
@@ -62,7 +61,7 @@
<group string="新岗位信息">
<field name="prepare_approval_line_ids" string=" ">
<tree editable="bottom" delete="false">
<field name="name"/>
<field name="hr_job_id" />
<field name="prepare_approval_id" column_invisible="1"/>
<field name="department_id"/>
<field name="job_type_id"/>