Files
gzth/yuthon_hr_employee/models/inherit_hr_job.py
T
2024-09-20 19:21:27 +08:00

85 lines
3.9 KiB
Python

# -*- coding: utf-8 -*-
from odoo import api, fields, models, _
import datetime
class HrJob(models.Model):
_inherit = "hr.job"
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'),
('thlc', '天河粮储'), ('tctj', '天投城建')], string="所属公司")
job_type_id = fields.Many2one('hr.job.type', string="岗位类别")
job_lv_id = fields.Many2one('yuthon.job.lv', string="职级")
start_time = fields.Date(string="生效时间", default=lambda self: fields.Date.today())
end_time = fields.Date(string="失效时间")
is_enable = fields.Boolean(string="是否启用", default=False, compute="compute_is_enable", store=True)
compiling_external = fields.Integer(string="编制外人数")
compiling_status = fields.Selection([('1', '缺编'), ('2', '满编')], compute="_compute_compiling_status", string="状态")
missing_number = fields.Integer(string="缺编人数",compute='_depends_missing_number')
establishment_quotas = fields.Integer(string="编制定员")
job_personnel = fields.Char(string="在岗人员")
remarks = fields.Text(string="备注")
is_recruitment_status = fields.Boolean(string="招聘状态")
#任职要求
degree = fields.Selection([('high', '高中'), ('junior_college', '大专'), ('bachelor', '本科'),
('master', '硕士'), ('doctor', '博士')], string="学历")
approval_sex = fields.Selection([('girl', '女'), ('boy', '男')], string="性别")
age_start = fields.Integer(string="年龄")
age_end = fields.Integer(string="年龄")
political_aspects = fields.Selection([('cpc_dang', '中共党员'), ('nld', '民盟'),
('league_member', '共青团员'), ('people', '群众')], string="政治面貌")
professional = fields.Char(string="专业")
title = fields.Char(string="职称")
admissions = fields.Char(string="执业资格")
years_of_service = fields.Integer(string="工作年限")
competency_requirements = fields.Text(string="能力要求")
other_notes = fields.Text(string="其他要求说明")
#招聘信息
date_of_filing = fields.Date(string="申报日期")
reason_recruitment = fields.Char(string="招聘事由")
ideal_date = fields.Date(string="希望到岗日期")
recruit_start_date = fields.Date(string="招聘开始日期")
recruit_end_date = fields.Date(string="招聘截止日期")
recruit_over_date = fields.Date(string="招聘结束日期")
recruit_priority = fields.Selection([('high', '高'), ('middle', '中'), ('low', '低')], string="招聘优先级")
place_work = fields.Char(string="工作地点")
is_referral = fields.Boolean(string="允许员工推荐")
job_description = fields.Text(string="招聘情况说明")
publish_applicant_ids = fields.Many2many('publish.applicant.setting', string="招聘发布途径")
@api.depends('establishment_quotas', 'no_of_employee')
def _compute_compiling_status(self):
for state in self:
if state.no_of_employee < state.establishment_quotas:
state.compiling_status = '1'
else:
state.compiling_status = '2'
@api.depends('establishment_quotas', 'no_of_employee')
def _depends_missing_number(self):
for rec in self:
rec.missing_number = rec.establishment_quotas - rec.no_of_employee
@api.depends('start_time', 'end_time')
def compute_is_enable(self):
for rec in self:
if rec.start_time and rec.end_time:
if rec.start_time < datetime.datetime.now() and rec.end_time > datetime.datetime.now():
rec.is_enable = True
else:
rec.is_enable = False
else:
rec.is_enable = False
class HrJobType(models.Model):
_name = "hr.job.type"
name = fields.Char(string="类别名称")