添加功能

This commit is contained in:
zhouzhou
2024-11-06 16:05:15 +08:00
parent 226efb8c23
commit 61b27ed10d
16 changed files with 239 additions and 97 deletions
+1 -1
View File
@@ -187,4 +187,4 @@ class SoongWorkflow(models.Model):
for record in self.search([]):
if record.end_date:
if record.end_date < fields.Date.today():
record.is_enable = False
record.is_enable = False
+1
View File
@@ -17,6 +17,7 @@
'data/job_lv_groups_data.xml',
'data/employee_code_data.xml',
'data/applicant_tage_setting_data.xml',
'data/employee_recruitment_time_data.xml',
'data/publish_applicant_setting_data.xml',
'security/ir.model.access.csv',
'security/job_lv_security_group.xml',
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<data noupdate="1">
<record forcecreate="True" id="employee_recruitment_time_data" model="ir.cron">
<field name="name">定时任务:招聘岗位的失效时间</field>
<field name="model_id" ref="model_hr_job"/>
<field name="state">code</field>
<field name="code">model.employee_recruitment_time()</field>
<field eval="False" name="active"/>
<field name="user_id" ref="base.user_root"/>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="nextcall" eval="(DateTime.now()).strftime('%Y-%m-%d 00:00:00')"/>
<field name="numbercall">-1</field>
<field eval="False" name="doall"/>
</record>
</data>
</odoo>
@@ -5,12 +5,14 @@ import datetime
class HrJob(models.Model):
_inherit = "hr.job"
_order = 'number asc'
_sql_constraints = [
('name_company_uniq', 'unique(name)', 'The name of the job position must be unique per department in company!'),
('no_of_recruitment_positive', 'CHECK(no_of_recruitment >= 0)', 'The expected number of new employees must be positive.')
]
number = fields.Char(string="序号", store=True)
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'),
('thlc', '天河粮储'), ('tctj', '天投城建'),('thtjbb', '天河投资本部')], string="所属公司")
job_type_id = fields.Many2one('hr.job.type', string="岗位类别")
@@ -74,6 +76,12 @@ class HrJob(models.Model):
else:
rec.is_enable = False
def employee_recruitment_time(self):
for record in self.search([]):
if record.end_date:
if record.end_date < fields.Date.today():
record.is_enable = False
class HrJobType(models.Model):
_name = "hr.job.type"
@@ -20,6 +20,9 @@
<xpath expr="//field[@name='no_of_recruitment']" position="attributes">
<attribute name="column_invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='name']" position="before">
<field name="number"/>
</xpath>
<xpath expr="//field[@name='department_id']" position="after">
<field name="job_type_id"/>
<field name="job_lv_id"/>
@@ -106,6 +109,7 @@
</xpath>
<xpath expr="//field[@name='department_id']" position="after">
<field name="job_type_id"/>
<field name="number"/>
<field name="establishment_quotas"/>
<field name="no_of_employee" string="在编人数"/>
<field name="compiling_external"/>
@@ -7,7 +7,7 @@ class HrApplicant(models.Model):
interview_approval_id = fields.Many2one('yuthon.interview.approval', string="面试申请表关联")
interview_time = fields.Datetime(string='面试时间')
room_id = fields.Many2one('room.room',string='地点')
interview_results = fields.Selection([('pass', '通过'), ('fail', '不通过')], 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='面试官')
@@ -21,7 +21,6 @@ class HrApplicant(models.Model):
'target': 'current',
}
def pub_interview_approval(self):
for applicant in self:
if not applicant.is_interview_status:
@@ -31,26 +30,19 @@ class HrApplicant(models.Model):
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)]
stage_list = [stage.name for stage in self.env['hr.recruitment.stage'].search([])] # 便利出所有的阶段
for sta in self:
stage_self = stage_list.index(sta.stage_id.name)
if stage_self == 0:
sta.stage_id = self.env['hr.recruitment.stage'].search([('name', '=', stage_list[stage_self + 1])]).id
form_id = self.env.ref("yuthon_hr_employee_approval.view_yuthon_interview_approval_form").id
return {
'type': 'ir.actions.act_window',
'name': '提交面试申请',
'res_model': 'yuthon.interview.approval',
"views": [[form_id, "form"]],
"context": {
'default_name': '面试申请表',
'default_job_id': self.job_id.id,
'default_department_id': self.department_id.id,
'default_applicant_ids': hr_applicant_data
}
form_id = self.env.ref("yuthon_hr_employee_approval.view_yuthon_interview_approval_form").id
return {
'type': 'ir.actions.act_window',
'name': '提交面试申请',
'res_model': 'yuthon.interview.approval',
"views": [[form_id, "form"]],
"context": {
'default_name': '面试申请表',
'default_job_id': self.job_id.id,
'default_department_id': self.department_id.id,
'default_applicant_ids': hr_applicant_data
}
}
def write(self, vals):
@@ -78,4 +70,4 @@ class HrApplicant(models.Model):
"views": [[form_id, "form"]],
'context': {
'onboard_id': self.id, },
}
}
@@ -33,22 +33,6 @@ 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')))
hr_job_data = []
for job in hr_job_ids:
hr_job_data.append((0, 0, {
'name': job.name,
'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,
}))
form_id = self.env.ref("yuthon_hr_employee_approval.view_yuthon_prepare_approval_form").id
return {
'type': 'ir.actions.act_window',
@@ -56,6 +40,6 @@ class HrJob(models.Model):
'res_model': 'yuthon.prepare.approval',
"views": [[form_id, "form"]],
"context": {
'default_adjust_information_ids': hr_job_data,
'default_adjust_information_ids': [(6 ,0 , hr_job_ids.ids)],
}
}
@@ -33,4 +33,8 @@ class YuthonInterviewApproval(models.Model):
}
}
def put_interview_stage(self):
for rec in self.applicant_ids:
rec.write({
'stage_id': rec.interview_stage_id.id})
@@ -6,16 +6,100 @@ class YuthonPrepareApproval(models.Model):
_description = '编制调整需求表'
_inherit = 'soong.workflow.mixin'
name = fields.Char(string='名称')
employee_id = fields.Many2one('hr.employee', string='申请人', default=lambda self: self.env.user.employee_id)
code = fields.Char(string="编号",
default=lambda self: self.env['ir.sequence'].next_by_code('yuthon_prepare_approval_code'))
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'),
('thlc', '天河粮储'), ('tctj', '天投城建')], string="所属公司")
department_id = fields.Many2one("hr.department", string="部门", required=True)
reason = fields.Char(string="事由")
notice_documents_ids = fields.Many2many('documents.document', string="附件")
department_id = fields.Many2one("hr.department", string="部门",)
name = fields.Char(string='标题')
reason = fields.Html(string="正文")
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="关联编制调整需求表行")
@api.onchange('adjust_information_ids')
def onchange_change_index_library_ids(self):
new_lines = []
for old in self:
for new in old.adjust_information_ids:
new_lines.append((0, 0, {
'name': new.name,
'department_id': new.department_id,
'yuthon_company': new.yuthon_company,
'job_type_id': new.job_type_id,
'compiling_external': new.compiling_external,
'job_lv_id': new.job_lv_id,
'establishment_quotas': new.establishment_quotas,
'no_of_employee': new.no_of_employee,
'missing_number': new.missing_number,
'compiling_status': new.compiling_status,
'job_personnel': new.job_personnel,
'remarks': new.remarks,
}))
self.prepare_approval_line_ids = new_lines
adjust_information_ids = fields.One2many('hr.job', 'prepare_approval_id', string="调整信息")
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,
'department_id': prepare.department_id.id,
'yuthon_company': prepare.yuthon_company,
'job_type_id': prepare.job_type_id.id,
'compiling_external': prepare.compiling_external,
'job_lv_id': prepare.job_lv_id.id,
'establishment_quotas': prepare.establishment_quotas,
'no_of_employee': prepare.no_of_employee,
'missing_number': prepare.missing_number,
'compiling_status': prepare.compiling_status,
'job_personnel': prepare.job_personnel,
'remarks': prepare.remarks,
})
class PrepareApprovalLine(models.Model):
_name = 'yuthon.prepare.approval.line'
_description = '新编制调整需求表行'
_inherit = 'soong.workflow.mixin'
prepare_approval_id = fields.Many2one('yuthon.prepare.approval', string="编制调整需求表")
name = fields.Char(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'
@@ -7,18 +7,21 @@ class YuthonRecruitmentApproval(models.Model):
_inherit = 'soong.workflow.mixin'
name = fields.Char(string='标题')
employee_id = fields.Many2one('hr.employee', string='申请人', default=lambda self: self.env.user.employee_id)
employee_id = fields.Many2one('hr.employee',string='申请人', default=lambda self: self.env.user.employee_id)
code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('yuthon_recruitment_approval_code'))
reason = fields.Html(string="正文")
notice_documents_ids = fields.Many2many('ir.attachment', string="附件")
recruitment_ids = fields.One2many('hr.job', 'recruitment_approval_id', string="招聘申请")
is_issues = fields.Boolean(string='是否上会')
related_issues_id = fields.Many2one('issue.library', string="关联议题")
notice_documents_ids = fields.Many2many('ir.attachment', string='议题附件')
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'),
('thlc', '天河粮储'), ('tctj', '天投城建')], string="所属公司")
('thlc', '天河粮储'), ('tctj', '天投城建')], string="所属公司")
department_id = fields.Many2one("hr.department", string="部门")
def put_time_failure(self):
for record in self:
for recruitment in record.recruitment_ids:
recruitment.website_published = True
@@ -28,4 +28,5 @@ access_education_details_line2,education_details_line2,model_education_details_l
access_certificates_detail_line,certificates_detail_line,model_certificates_detail_line,base.group_user,1,1,1,1
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_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
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
28 access_certificates_detail_line certificates_detail_line model_certificates_detail_line base.group_user 1 1 1 1
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 yuthon_prepare_approval_line model_yuthon_prepare_approval_line base.group_user 1 1 1 1
@@ -19,6 +19,7 @@
<form>
<header>
<button name="scheduling_of_meetings" string="会议安排" type="object" class='btn btn-primary'/>
<button name="put_interview_stage" string="按钮" type="object" class='btn btn-primary'/>
</header>
<sheet>
<group col="2">
@@ -47,7 +48,7 @@
<field name="room_id"/>
<field name="tage_ids" widget="many2many_tags"/>
<field name="employee_ids" widget="many2many_tags"/>
<field name="interview_results"/>
<field name="interview_stage_id"/>
<button name="buttn_applicant_ids" type="object" string="详细信息"/>
</tree>
</field>
@@ -6,6 +6,8 @@
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="code"/>
<field name="employee_id"/>
</tree>
</field>
</record>
@@ -14,40 +16,73 @@
<field name="model">yuthon.prepare.approval</field>
<field name="arch" type="xml">
<form>
<header>
<button name="put_adjustment_approval" type="object" string="按钮"/>
</header>
<sheet>
<div class="col-12 text-center">
<h1>
<field name="name"/>
</h1>
</div>
<group col="2">
<group>
<field name="yuthon_company"/>
<field name="department_id"/>
</group>
<group>
<field name="reason"/>
<field name="notice_documents_ids" widget="many2many_tags"/>
</group>
<group col="2" string="个人信息">
<group>
<field name="employee_id"/>
<field name="yuthon_company" invisible="1"/>
</group>
<group>
<field name="code"/>
<field name="department_id" invisible="1"/>
<field name="is_issues" invisible="1"/>
</group>
</group>
<field name="adjust_information_ids">
<tree editable="bottom">
<field name="name"/>
<field name="prepare_approval_id" column_invisible="1"/>
<field name="department_id"/>
<field name="company_id" column_invisible="1"/>
<field name="job_type_id"/>
<field name="job_lv_id"/>
<field name="yuthon_company"/>
<field name="establishment_quotas"/>
<field name="no_of_employee"/>
<field name="compiling_external"/>
<field name="missing_number"/>
<field name="compiling_status"/>
<field name="job_personnel"/>
<field name="remarks"/>
</tree>
</field>
<group string="审批事项">
<field name="name"/>
<field name="reason"/>
<field name="notice_documents_ids" widget="preview_many2many"/>
</group>
<notebook>
<page string="调整信息">
<group string="原岗位信息">
<group/>
<field name="adjust_information_ids" string=" ">
<tree editable="bottom" create="false" delete="false">
<field name="name"/>
<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"/>
<field name="compiling_external"/>
<field name="missing_number"/>
<field name="compiling_status"/>
<field name="job_personnel"/>
<field name="remarks"/>
</tree>
</field>
</group>
<group string="新岗位信息">
<field name="prepare_approval_line_ids" string=" ">
<tree editable="bottom" delete="false">
<field name="name"/>
<field name="prepare_approval_id" column_invisible="1"/>
<field name="department_id"/>
<field name="job_type_id"/>
<field name="job_lv_id"/>
<field name="yuthon_company"/>
<field name="establishment_quotas"/>
<field name="no_of_employee"/>
<field name="compiling_external"/>
<field name="missing_number"/>
<field name="compiling_status"/>
<field name="job_personnel"/>
<field name="remarks"/>
</tree>
</field>
</group>
</page>
<page string="关联议题" invisible="not is_issues">
<field name="related_issues_id"/>
</page>
</notebook>
</sheet>
</form>
</field>
@@ -6,8 +6,8 @@
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="code"/>
<field name="employee_id"/>
<field name="code"/>
</tree>
</field>
</record>
@@ -16,24 +16,29 @@
<field name="model">yuthon.recruitment.approval</field>
<field name="arch" type="xml">
<form>
<header>
<button name="put_time_failure" type="object" string="按钮" class="oe_highlight"/>
</header>
<sheet>
<group col="2" string="个人信息">
<group>
<field name="employee_id"/>
<field name="yuthon_company" invisible="1"/>
</group>
<group>
<field name="code"/>
<field name="department_id" invisible="1"/>
<field name="is_issues" invisible="1"/>
</group>
</group>
<group string="审批事项">
<field name="name" required="1"/>
<field name="name"/>
<field name="reason"/>
<field name="notice_documents_ids" widget="preview_many2many"/>
</group>
<notebook>
<page string="岗位">
<field name="recruitment_ids">
<field name="recruitment_ids" string=" ">
<tree create="false" edit="false" delete="false" editable="bottom">
<field name="company_id" column_invisible="1"/>
<field name="recruitment_approval_id" column_invisible="1"/>
@@ -19,7 +19,9 @@
<field name="arch" type="xml">
<form string="合并管理">
<sheet>
<button name="put_merge_message" type="object" string="按钮" class="oe_highlight"/>
<header>
<button name="put_merge_message" type="object" string="按钮" class="oe_highlight"/>
</header>
<group string="审批事项">
<field name="name"/>
<field name="code"/>
+8 -8
View File
@@ -6,9 +6,9 @@
<field name="active">False</field>
</record>
<!-- 人事 -->
<!-- <record id="hr.menu_hr_root" model="ir.ui.menu">-->
<!-- <field name="active">False</field>-->
<!-- </record>-->
<!-- <record id="hr.menu_hr_root" model="ir.ui.menu">-->
<!-- <field name="active">False</field>-->
<!-- </record>-->
<!-- 出勤 -->
<record id="hr_attendance.menu_hr_attendance_root" model="ir.ui.menu">
<field name="active">False</field>
@@ -195,6 +195,11 @@
parent="hr_employee_menu_root_board"
action="hr.action_hr_job"
sequence="5"/>
<menuitem id="hr_set_role_menu_root_board"
name="角色管理"
parent="hr_employee_menu_root_board"
action="soong_workflow.view_soong_user_role_action"
sequence="7"/>
<menuitem id="hr_contract_menu_root_board"
name="合同管理"
parent="hr_employee_menu_root_board"
@@ -273,11 +278,6 @@
parent="hr_set_employee_menu_root_board"
action="resource.action_resource_calendar_form"
sequence="5"/>
<menuitem id="hr_set_role_menu_root_board"
name="角色配置"
parent="hr_set_employee_menu_root_board"
action="soong_workflow.view_soong_user_role_action"
sequence="9"/>
<menuitem id="hu_privileges_employee_menu_root_board"
name="角色权限"
parent="hr_set_employee_menu_root_board"