diff --git a/yuthon_hr_employee/models/inherit_hr_applicant.py b/yuthon_hr_employee/models/inherit_hr_applicant.py index b45a56f6a..78195452e 100644 --- a/yuthon_hr_employee/models/inherit_hr_applicant.py +++ b/yuthon_hr_employee/models/inherit_hr_applicant.py @@ -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" diff --git a/yuthon_hr_employee/views/inherit_hr_applicant_views.xml b/yuthon_hr_employee/views/inherit_hr_applicant_views.xml index 46acc239f..0e2cba161 100644 --- a/yuthon_hr_employee/views/inherit_hr_applicant_views.xml +++ b/yuthon_hr_employee/views/inherit_hr_applicant_views.xml @@ -7,11 +7,6 @@
-
-

- -

-
diff --git a/yuthon_hr_employee_approval/models/inherit_hr_applicant.py b/yuthon_hr_employee_approval/models/inherit_hr_applicant.py index ed5b5c19b..a893b9b7e 100644 --- a/yuthon_hr_employee_approval/models/inherit_hr_applicant.py +++ b/yuthon_hr_employee_approval/models/inherit_hr_applicant.py @@ -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: diff --git a/yuthon_hr_employee_approval/models/inherit_hr_employee.py b/yuthon_hr_employee_approval/models/inherit_hr_employee.py index b39a7deaa..24c5e3ef4 100644 --- a/yuthon_hr_employee_approval/models/inherit_hr_employee.py +++ b/yuthon_hr_employee_approval/models/inherit_hr_employee.py @@ -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: diff --git a/yuthon_hr_employee_approval/models/inherit_hr_job.py b/yuthon_hr_employee_approval/models/inherit_hr_job.py index 3b5520de2..c7382945a 100644 --- a/yuthon_hr_employee_approval/models/inherit_hr_job.py +++ b/yuthon_hr_employee_approval/models/inherit_hr_job.py @@ -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, } } diff --git a/yuthon_hr_employee_approval/models/yuthon_interview_approval.py b/yuthon_hr_employee_approval/models/yuthon_interview_approval.py index 04bfd7a95..03424f66a 100644 --- a/yuthon_hr_employee_approval/models/yuthon_interview_approval.py +++ b/yuthon_hr_employee_approval/models/yuthon_interview_approval.py @@ -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', + } \ No newline at end of file diff --git a/yuthon_hr_employee_approval/models/yuthon_onboard_approval.py b/yuthon_hr_employee_approval/models/yuthon_onboard_approval.py index 815b516d0..4a6b8212c 100644 --- a/yuthon_hr_employee_approval/models/yuthon_onboard_approval.py +++ b/yuthon_hr_employee_approval/models/yuthon_onboard_approval.py @@ -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, + }} diff --git a/yuthon_hr_employee_approval/models/yuthon_prepare_approval.py b/yuthon_hr_employee_approval/models/yuthon_prepare_approval.py index b79631c88..2ec6cc104 100644 --- a/yuthon_hr_employee_approval/models/yuthon_prepare_approval.py +++ b/yuthon_hr_employee_approval/models/yuthon_prepare_approval.py @@ -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="所属公司") diff --git a/yuthon_hr_employee_approval/security/ir.model.access.csv b/yuthon_hr_employee_approval/security/ir.model.access.csv index fdc5525a3..d87b074d6 100644 --- a/yuthon_hr_employee_approval/security/ir.model.access.csv +++ b/yuthon_hr_employee_approval/security/ir.model.access.csv @@ -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 \ No newline at end of file +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 \ No newline at end of file diff --git a/yuthon_hr_employee_approval/views/yuthon_interview_approval_views.xml b/yuthon_hr_employee_approval/views/yuthon_interview_approval_views.xml index 57d7169ff..6f866e4f3 100644 --- a/yuthon_hr_employee_approval/views/yuthon_interview_approval_views.xml +++ b/yuthon_hr_employee_approval/views/yuthon_interview_approval_views.xml @@ -31,7 +31,7 @@ - + @@ -39,13 +39,9 @@ - - - - - + + - diff --git a/yuthon_hr_employee_approval/views/yuthon_onboard_approval_views.xml b/yuthon_hr_employee_approval/views/yuthon_onboard_approval_views.xml index 5b389b25b..9e7ed97eb 100644 --- a/yuthon_hr_employee_approval/views/yuthon_onboard_approval_views.xml +++ b/yuthon_hr_employee_approval/views/yuthon_onboard_approval_views.xml @@ -5,7 +5,6 @@ yuthon.onboard.approval - @@ -18,14 +17,11 @@ -
-

- -

-
+
+
- @@ -35,7 +31,7 @@ - + @@ -74,7 +70,7 @@ - + diff --git a/yuthon_hr_employee_approval/views/yuthon_prepare_approval_views.xml b/yuthon_hr_employee_approval/views/yuthon_prepare_approval_views.xml index 62c3db661..712f57c7a 100644 --- a/yuthon_hr_employee_approval/views/yuthon_prepare_approval_views.xml +++ b/yuthon_hr_employee_approval/views/yuthon_prepare_approval_views.xml @@ -42,12 +42,11 @@ - + - @@ -62,7 +61,7 @@ - +